[PATCH] Fix several places where diff.renames in config can be problematic

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



git-cvsexportcommit.perl:
git-cvsserver.perl:
	CVS can't handle renames, so we best not show them to
	users.

templates/hooks--update:
	replace diffstat calls with git diff --stat

There may be other places where users having diff.renames can be
problematic, too.  diff.renames is opt-in, but maybe some users
have enabled it in their configs previously because it's been
in examples for a long time...

Signed-off-by: Eric Wong <normalperson@xxxxxxxx>
---
 Junio C Hamano <junkio@xxxxxxx> wrote:
 > Junio C Hamano <junkio@xxxxxxx> writes:
 > 
 > > I am more worried about somebody who opts-in finds breakage of
 > > commands that happen to internally use low-level diff machinery
 > > and expect the diff machinery does not automagically do funny
 > > rename detection without being told.
 > > ...
 > > That is why I said I do not want this at _that_ low level.  I do
 > > not have objections to have the configuration at a layer closer
 > > to the UI, e.g. things in builtin-log.c and builtin-diff.c.
 > 
 > Upon closer look I think the revision pruning code is OK.  So
 > let's cook this as is in "next" and see what happens.

 Cool.  I've found these that could be potential issues.  There could be
 more, and possibly many in 3rd-party scripts outside our control, too.

 git-cvsexportcommit.perl |    8 +++++---
 git-cvsserver.perl       |    2 +-
 templates/hooks--update  |    4 ++--
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/git-cvsexportcommit.perl b/git-cvsexportcommit.perl
index d1051d0..09ff2cc 100755
--- a/git-cvsexportcommit.perl
+++ b/git-cvsexportcommit.perl
@@ -91,7 +91,8 @@ close MSG;
 $? && die "Error extracting the commit message";
 
 my (@afiles, @dfiles, @mfiles, @dirs);
-my @files = safe_pipe_capture('git-diff-tree', '-r', $parent, $commit);
+my @files = safe_pipe_capture('git-diff-tree','--no-renames','-r',
+				$parent, $commit);
 #print @files;
 $? && die "Error in git-diff-tree";
 foreach my $f (@files) {
@@ -175,7 +176,8 @@ foreach my $d (@dirs) {
 
 print "'Patching' binary files\n";
 
-my @bfiles = grep(m/^Binary/, safe_pipe_capture('git-diff-tree', '-p', $parent, $commit));
+my @bfiles = grep(m/^Binary/, safe_pipe_capture('git-diff-tree','--no-renames',
+						'-p', $parent, $commit));
 @bfiles = map { chomp } @bfiles;
 foreach my $f (@bfiles) {
     # check that the file in cvs matches the "old" file
@@ -206,7 +208,7 @@ ## apply non-binary changes
 my $fuzz = $opt_p ? 0 : 2;
 
 print "Patching non-binary files\n";
-print `(git-diff-tree -p $parent -p $commit | patch -p1 -F $fuzz ) 2>&1`;
+print `(git-diff-tree --no-renames -p $parent -p $commit | patch -p1 -F $fuzz ) 2>&1`;
 
 my $dirtypatch = 0;
 if (($? >> 8) == 2) {
diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index 5ccca4f..ae878ea 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -2295,7 +2295,7 @@ sub update
 
         if ( defined ( $lastpicked ) )
         {
-            my $filepipe = open(FILELIST, '-|', 'git-diff-tree', '-r', $lastpicked, $commit->{hash}) or die("Cannot call git-diff-tree : $!");
+            my $filepipe = open(FILELIST, '-|', 'git-diff-tree', '--no-merges', '-r', $lastpicked, $commit->{hash}) or die("Cannot call git-diff-tree : $!");
             while ( <FILELIST> )
             {
                 unless ( /^:\d{6}\s+\d{3}(\d)\d{2}\s+[a-zA-Z0-9]{40}\s+([a-zA-Z0-9]{40})\s+(\w)\s+(.*)$/o )
diff --git a/templates/hooks--update b/templates/hooks--update
index d7a8f0a..76d5ac2 100644
--- a/templates/hooks--update
+++ b/templates/hooks--update
@@ -60,7 +60,7 @@ then
 			echo "Changes since $prev:"
 			git rev-list --pretty $prev..$3 | $short
 			echo ---
-			git diff $prev..$3 | diffstat -p1
+			git diff --stat $prev..$3
 			echo ---
 		fi
 		;;
@@ -75,7 +75,7 @@ else
 	base=$(git-merge-base "$2" "$3")
 	case "$base" in
 	"$2")
-		git diff "$3" "^$base" | diffstat -p1
+		git diff --stat "$3" "^$base"
 		echo
 		echo "New commits:"
 		;;
-- 
1.4.1.gc57e

-
: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]