All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Keeping <john@keeping.me.uk>
To: David Aguilar <davvid@gmail.com>
Cc: Matt McClure <matthewlmcclure@gmail.com>,
	"git@vger.kernel.org" <git@vger.kernel.org>,
	Tim Henigan <tim.henigan@gmail.com>
Subject: Re: difftool -d symlinks, under what conditions
Date: Tue, 12 Mar 2013 19:43:06 +0000	[thread overview]
Message-ID: <20130312194306.GE2317@serenity.lan> (raw)
In-Reply-To: <CAJDDKr7S0ex1RvZS0QeBXxAuqcKrQJzhZeJP0MoMGmpGXyMOrA@mail.gmail.com>

On Tue, Mar 12, 2013 at 12:23:52PM -0700, David Aguilar wrote:
> I don't think we could do this without adding an additional flag
> to trigger this change in behavior (e.g. --null-sha1-for-....?)
> so that existing users are unaffected by the change.
> 
> It feels like forcing the null SHA-1 is heavy-handed, but I
> haven't thought it through enough.
> 
> While this may be a quick way to get this behavior,
> I wonder if there is a better way.
> 
> Does anybody else have any comments/suggestions on how to
> better accomplish this?

How about something like "--symlink-all" where the everything in the
right-hand tree is symlink'd?

Something like this perhaps:

-- >8 --
diff --git a/git-difftool.perl b/git-difftool.perl
index 0a90de4..cab7c45 100755
--- a/git-difftool.perl
+++ b/git-difftool.perl
@@ -85,7 +85,7 @@ sub exit_cleanup
 
 sub setup_dir_diff
 {
-	my ($repo, $workdir, $symlinks) = @_;
+	my ($repo, $workdir, $symlinks, $symlink_all) = @_;
 
 	# Run the diff; exit immediately if no diff found
 	# 'Repository' and 'WorkingCopy' must be explicitly set to insure that
@@ -159,10 +159,10 @@ EOF
 		}
 
 		if ($rmode ne $null_mode) {
-			if ($rsha1 ne $null_sha1) {
-				$rindex .= "$rmode $rsha1\t$dst_path\0";
-			} else {
+			if ($symlink_all or $rsha1 eq $null_sha1) {
 				push(@working_tree, $dst_path);
+			} else {
+				$rindex .= "$rmode $rsha1\t$dst_path\0";
 			}
 		}
 	}
@@ -299,6 +299,7 @@ sub main
 		prompt => undef,
 		symlinks => $^O ne 'cygwin' &&
 				$^O ne 'MSWin32' && $^O ne 'msys',
+		symlink_all => undef,
 		tool_help => undef,
 	);
 	GetOptions('g|gui!' => \$opts{gui},
@@ -308,6 +309,7 @@ sub main
 		'y' => sub { $opts{prompt} = 0; },
 		'symlinks' => \$opts{symlinks},
 		'no-symlinks' => sub { $opts{symlinks} = 0; },
+		'symlink-all' => \$opts{symlink_all},
 		't|tool:s' => \$opts{difftool_cmd},
 		'tool-help' => \$opts{tool_help},
 		'x|extcmd:s' => \$opts{extcmd});
@@ -346,7 +348,7 @@ sub main
 	# will invoke a separate instance of 'git-difftool--helper' for
 	# each file that changed.
 	if (defined($opts{dirdiff})) {
-		dir_diff($opts{extcmd}, $opts{symlinks});
+		dir_diff($opts{extcmd}, $opts{symlinks}, $opts{symlink_all});
 	} else {
 		file_diff($opts{prompt});
 	}
@@ -354,13 +356,13 @@ sub main
 
 sub dir_diff
 {
-	my ($extcmd, $symlinks) = @_;
+	my ($extcmd, $symlinks, $symlink_all) = @_;
 	my $rc;
 	my $error = 0;
 	my $repo = Git->repository();
 	my $workdir = find_worktree($repo);
 	my ($a, $b, $tmpdir, @worktree) =
-		setup_dir_diff($repo, $workdir, $symlinks);
+		setup_dir_diff($repo, $workdir, $symlinks, $symlink_all);
 
 	if (defined($extcmd)) {
 		$rc = system($extcmd, $a, $b);

  reply	other threads:[~2013-03-12 19:43 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-26 20:23 difftool -d symlinks, under what conditions Matt McClure
2012-11-27  6:20 ` David Aguilar
2012-11-27 21:10   ` Matt McClure
     [not found]   ` <CAJELnLEL8y0G3MBGkW+YDKtVxX4n4axJG7p0oPsXsV4_FRyGDg@mail.gmail.com>
2013-03-12 18:12     ` Matt McClure
2013-03-12 19:09       ` John Keeping
2013-03-12 19:23         ` David Aguilar
2013-03-12 19:43           ` John Keeping [this message]
2013-03-12 20:39             ` Junio C Hamano
2013-03-12 21:06               ` John Keeping
2013-03-12 21:26                 ` Junio C Hamano
2013-03-12 21:43                 ` Matt McClure
2013-03-12 22:11                   ` Matt McClure
2013-03-12 22:16                   ` Junio C Hamano
2013-03-12 22:48                     ` Matt McClure
2013-03-13  0:17                       ` John Keeping
2013-03-13  0:56                         ` Matt McClure
2013-03-13  8:24                         ` David Aguilar
2013-03-13 15:30                           ` Junio C Hamano
2013-03-13 16:45                             ` Junio C Hamano
2013-03-13 17:08                               ` John Keeping
2013-03-13 17:40                                 ` Junio C Hamano
2013-03-13 18:01                                   ` John Keeping
2013-03-13 19:28                                     ` Junio C Hamano
2013-03-13 20:33                                       ` [PATCH 0/2] difftool --dir-diff: symlink all files matching the working tree John Keeping
2013-03-13 20:33                                         ` [PATCH 1/2] git-difftool(1): fix formatting of --symlink description John Keeping
2013-03-13 20:33                                         ` [PATCH 2/2] difftool --dir-diff: symlink all files matching the working tree John Keeping
2013-03-14  3:41                                           ` David Aguilar
2013-03-14  9:36                                             ` John Keeping
2013-03-14 15:18                                           ` Junio C Hamano
2013-03-14 20:19                                         ` [PATCH v2 0/3] " John Keeping
2013-03-14 20:19                                           ` [PATCH v2 1/3] git-difftool(1): fix formatting of --symlink description John Keeping
2013-03-14 20:19                                           ` [PATCH v2 2/3] difftool: avoid double slashes in symlink targets John Keeping
2013-03-14 21:19                                             ` Junio C Hamano
2013-03-14 20:19                                           ` [PATCH v2 3/3] difftool --dir-diff: symlink all files matching the working tree John Keeping
2013-03-14 21:28                                             ` Junio C Hamano
2013-03-14 22:24                                               ` John Keeping
2013-03-14 22:31                                                 ` Junio C Hamano
2013-03-14  9:43                               ` difftool -d symlinks, under what conditions John Keeping
2013-03-14 17:25                                 ` John Keeping
2013-03-14 17:33                                   ` Junio C Hamano
2013-03-14 20:00                                     ` [PATCH 0/2] checkout-index: fix .gitattributes handling with --prefix John Keeping
2013-03-14 20:00                                       ` [PATCH 1/2] t2003: modernize style John Keeping
2013-03-14 20:00                                       ` [PATCH 2/2] entry: fix filter lookup John Keeping
2013-03-14 21:50                                         ` Junio C Hamano
2013-03-12 20:38           ` difftool -d symlinks, under what conditions Junio C Hamano
2013-03-12 19:24         ` [PATCH] difftool: Make directory diff symlink work tree John Keeping
2013-03-12 23:12           ` Matt McClure
2013-03-12 23:40             ` John Keeping
2013-03-13  0:26           ` Matt McClure
2013-03-13  9:11             ` John Keeping

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130312194306.GE2317@serenity.lan \
    --to=john@keeping.me.uk \
    --cc=davvid@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=matthewlmcclure@gmail.com \
    --cc=tim.henigan@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.