git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Thomas Rast <trast@student.ethz.ch>
Cc: git@vger.kernel.org, Sebastian Hahn <mail@sebastianhahn.net>
Subject: Re: gitk "find commit adding/removing string"/possible pickaxe bug?
Date: Tue, 18 Jan 2011 13:50:28 -0500	[thread overview]
Message-ID: <20110118185027.GA10562@sigill.intra.peff.net> (raw)
In-Reply-To: <201101181744.18139.trast@student.ethz.ch>

On Tue, Jan 18, 2011 at 05:44:17PM +0100, Thomas Rast wrote:

> In particular, in a history where
> 
>   $ git show HEAD:foo
>   quux
>   $ git show HEAD^:foo
>   bar
>   $ git show HEAD^2:foo
>   baz

I created a similar repo with:

commit() {
  echo $1 >file && git add file && git commit -m $1
}
mkdir repo && cd repo && git init
commit base
commit master
git checkout -b other HEAD^
commit other
git merge master
commit resolved

which should be identical. But I get different results (see near the
end):

> the behaviour is:
> 
>   git log -Squux                  # empty
>   git log -Squux -p               # empty

All of which make sense to me. Pickaxe operates on diff filepairs, and
git by default doesn't seem to do merge diffing at all (but see below).
So those filepairs don't exist to consider.

>   git log -Squux --pickaxe-all    # empty

This doesn't help. It just loosens the actual diff shown from "just the
things that matched -S" to "everything in that commit". It doesn't
add to the filepairs that make it to pickaxe.

>   git log -Squux -c      	  # shows merge, but no diff

This "-c" does what you want, because we start looking at merge
filepairs. Although one thing leaves me confused. If I do:

  git log -p

I get no diff for the merge commit. But in git-diff(1), it says:

  COMBINED DIFF FORMAT
    "git-diff-tree", "git-diff-files" and "git-diff" can take -c or --cc
    option to produce combined diff. For showing a merge commit with
    "git log -p", this is the default format; you can force showing full
    diff with the -m option.

which implies to me that "-c" should be on by default if we selected
"-p" (or presumably -S).

I didn't bisect, but I wonder if the doc is wrong, or if we accidentally
lost this default at some point.

>   git log -Squux --cc    	  # shows merge, but no diff

Makes sense again, since you didn't ask for a patch, no patch.

>   git log -Squux -c -p   	  # shows merge, but no diff

Weird.  Here I get a nice combined diff, which is what I expect.

>   git log -Squux -c --pickaxe-all # shows merge, but no diff

Yep, no "-p" again.

>   git log -Squux --pickaxe-all -c -p  # shows merge & combined diff

The pickaxe-all shouldn't impact anything, at least not in my test repo,
as there is only one file. But of course I do get the diff, as I did
above. Can you show the steps to create your repo? I'm wondering what is
different.

-Peff

  parent reply	other threads:[~2011-01-18 18:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-18 16:16 gitk "find commit adding/removing string"/possible pickaxe bug? Sebastian Hahn
2011-01-18 16:44 ` Thomas Rast
2011-01-18 18:39   ` Junio C Hamano
2011-01-18 18:50   ` Jeff King [this message]
2011-01-18 20:39     ` Thomas Rast
2011-01-18 20:50       ` Jeff King
2011-01-18 21:26         ` Junio C Hamano
2011-01-18 21:33           ` Jeff King
2011-01-31 20:00         ` Jeff King
2011-01-18 21:16       ` Thomas Rast

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=20110118185027.GA10562@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=mail@sebastianhahn.net \
    --cc=trast@student.ethz.ch \
    /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).