From: Eric Wong <normalperson@yhbt.net>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org, Martin Langhoff <martin.langhoff@gmail.com>
Subject: [PATCH] Fix several places where diff.renames in config can be problematic
Date: Fri, 7 Jul 2006 18:58:46 -0700 [thread overview]
Message-ID: <20060708015844.GA13769@soma> (raw)
In-Reply-To: <7v64i9zk0j.fsf@assigned-by-dhcp.cox.net>
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@yhbt.net>
---
Junio C Hamano <junkio@cox.net> wrote:
> Junio C Hamano <junkio@cox.net> 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
next prev parent reply other threads:[~2006-07-08 1:59 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-07 10:10 [PATCH 0/1] I forgot to run format-patch with the -M flag Eric Wong
2006-07-07 10:10 ` [PATCH] diff.c: respect diff.renames config option Eric Wong
2006-07-07 10:10 ` [PATCH] builtin-log: respect diff configuration options Eric Wong
2006-07-07 10:43 ` Junio C Hamano
2006-07-07 10:22 ` [PATCH] diff.c: respect diff.renames config option Junio C Hamano
[not found] ` <20060707110123.GA23400@soma>
2006-07-07 11:18 ` Junio C Hamano
2006-07-07 12:17 ` Junio C Hamano
2006-07-08 1:58 ` Eric Wong [this message]
2006-07-08 8:05 ` [PATCH] Fix several places where diff.renames in config can be problematic Junio C Hamano
2006-07-08 8:41 ` Eric Wong
2006-07-08 8:50 ` [PATCH] templates/hooks--update: replace diffstat calls with git diff --stat Eric Wong
2006-07-07 12:29 ` [PATCH] diff.c: respect diff.renames config option Junio C Hamano
2006-07-07 12:30 ` [PATCH] update Documentation/diff-options.txt Junio C Hamano
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=20060708015844.GA13769@soma \
--to=normalperson@yhbt.net \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
--cc=martin.langhoff@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).