git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Git Mailing List <git@vger.kernel.org>
Cc: Junio C Hamano <junkio@cox.net>
Subject: Fix embarrassing "git log --follow" bug
Date: Mon, 8 Oct 2007 13:42:41 -0700 (PDT)	[thread overview]
Message-ID: <alpine.LFD.0.999.0710081337490.4964@woody.linux-foundation.org> (raw)


It turns out that I completely broke "git log --follow" with my recent 
patch to revision.c ("Fix revision log diff setup, avoid unnecessary diff 
generation", commit b7bb760d5ed4881422673d32f869d140221d3564).

Why? Because --follow obviously requires the diff machinery to function, 
exactly the same way pickaxe does.

So everybody is away right now, but considering that nobody even noticed 
this bug, I don't think it matters. But for the record, here's the trivial 
one-liner fix (well, two, since I also fixed the comment).

Because of the nature of the bug, if you ask for patches when following 
(which is one of the things I normally do), the bug is hidden, because 
then the request for diff output will automatically also enable the diffs 
themselves.

So while "git log --follow <filename>" didn't work, adding a "-p" 
magically made it work again even without this fix.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---
 revision.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/revision.c b/revision.c
index 5d294be..e76da0d 100644
--- a/revision.c
+++ b/revision.c
@@ -1241,8 +1241,8 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
 	if (revs->diffopt.output_format & ~DIFF_FORMAT_NO_OUTPUT)
 		revs->diff = 1;
 
-	/* Pickaxe needs diffs */
-	if (revs->diffopt.pickaxe)
+	/* Pickaxe and rename following needs diffs */
+	if (revs->diffopt.pickaxe || revs->diffopt.follow_renames)
 		revs->diff = 1;
 
 	if (revs->topo_order)

             reply	other threads:[~2007-10-08 20:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <alpine.LFD.0.999.0710081337490.4964@woody.linux-foundation.org >
2007-10-08 20:42 ` Linus Torvalds [this message]
2007-10-08 20:46   ` Clean up "git log" format with DIFF_FORMAT_NO_OUTPUT Linus Torvalds
2007-10-08 20:55     ` Linus Torvalds
2007-10-09 16:35       ` [take 2] " Linus Torvalds

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=alpine.LFD.0.999.0710081337490.4964@woody.linux-foundation.org \
    --to=torvalds@linux-foundation.org \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /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).