git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Blaming diffs
@ 2007-09-16 16:38 Mike Hommey
  2007-09-16 17:05 ` Frank Lichtenheld
  2007-09-17  4:59 ` Christian Couder
  0 siblings, 2 replies; 7+ messages in thread
From: Mike Hommey @ 2007-09-16 16:38 UTC (permalink / raw)
  To: git

Hi,

It seems to me there is no tool to "blame diffs", i.e. something to know
what commit(s) is(are) responsible for a set of changes.

For example, the following script tries to get the set of commits
involved in the changes between $A and $B. Note it only works for text
additions. 

git diff --unified=0 $A $B | awk 'BEGIN { FS="(^(--- a/|+++ b/)|^@@ -[0-9,]+ \\+| @@)" } /^---/ || ( /^+++ b\/(.*)/ && file=="" ) { file = $2 } /^@@/ {split($2, a, /,/); a[2] = a[2] ? a[2] + a[1] - 1 : a[1]; print "git blame -l -L " a[1] "," a[2], "'$A..$B'", file }' | sh | cut -f 1 -d " " | sort -u

Has anyone tried to work on something similar yet ?

If not, as git users, what kind of output would you expect from such a
tool, and where do you think this should lie (extension to git diff, or
separate tool) ?

Cheers,

Mike

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-09-17  5:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-16 16:38 Blaming diffs Mike Hommey
2007-09-16 17:05 ` Frank Lichtenheld
2007-09-16 17:16   ` Mike Hommey
2007-09-17  4:59 ` Christian Couder
2007-09-17  4:57   ` Shawn O. Pearce
2007-09-17  5:40     ` Christian Couder
2007-09-17  5:41       ` Junio C Hamano

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).