Subject: Re: frustrated forensics: hard to find diff that undid a fix

From: Jonathan Nieder <[email-masked]>
Date: Sat, 5 Mar 2011 06:51:00 -0600

Hi,

Jakub Narebski wrote:

> I guess that pickaxe also needs -c or -m.

I am not so sure.

Pickaxe is used to ask, "what commit introduced this string?".  Using
"git log --raw -c", I can see that the current state of
contrib/fast-import/git-p4 came about in commit 6d74e5c9d (Merge
branch 'mh/p4', 2011-03-04):

| $ git log --oneline --raw -c
| 07873dc Merge branch 'maint'
| 
| 6d74e5c Merge branch 'mh/p4'
| 
| ::100755 100755 100755 a4f440d... 8b00fd8... 2df3bb2... MM
| contrib/fast-import/git-p4
[...]

Now, working backwards, I ask git:

| $ git log --oneline -S "$(cat contrib/fast-import/git-p4)" maint..master
| $

No hits.  Maybe it's from one of those mergey diffs?

| $ git log --oneline -m -S "$(cat contrib/fast-import/git-p4)" maint..master
| 07873dc (from 964498e) Merge branch 'maint'
| 6d74e5c (from 08fd871) Merge branch 'mh/p4'
| 6d74e5c (from c9dbab0) Merge branch 'mh/p4'
| $

Too many hits (it includes every merge in which one side contains
the string and the other does not).  How about -c, which seemed to
produce such nice output with --raw?

| $ git log --oneline -c -S "$(cat contrib/fast-import/git-p4)" maint..master
| 07873dc Merge branch 'maint'
| 6d74e5c Merge branch 'mh/p4'
| 08fd871 Merge branch 'mg/maint-difftool-vim-readonly'
| 5cb3c9b Merge branch 'jn/maint-commit-missing-template'
| 1538f21 Merge branch 'jk/diffstat-binary'
| 24161eb Merge branch 'lt/rename-no-extra-copy-detection'
| [...]

Oh.  diff_tree_combined_merge simply doesn't know about pickaxe,
so -c and --cc with -S print _all_ merges.

So the only sensible way to use pickaxe with merges is

| $ git log --oneline -m --first-parent \
|	-S "$(cat contrib/fast-import/git-p4)" maint..master
| 6d74e5c Merge branch 'mh/p4'

for now.  I'd be happy to help anyone hoping to improve this.
(Hopefully all that is needed is something like the
diff_queue_is_empty() check from v0.99~504 --- Diffcore updates,
2005-05-22.)