git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: difflame

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 30, 2017, 21:08 UTC
Message-ID
<xmqqd1f4uug6.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20170128035321.yrcqwkg2fiwadxj4@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 8 quoted lines
> On Tue, Jan 17, 2017 at 11:24:02PM -0600, Edmundo Carmona Antoranz wrote:
>
>> For a very long time I had wanted to get the output of diff to include
>> blame information as well (to see when something was added/removed).
>
> This is something I've wanted, too. The trickiest part, though, is
> blaming deletions, because git-blame only tracks the origin of content,
> not the origin of a change.

Hmph, this is a comment without looking at what difflame does internally, so you can ignore me if I am misunderstood what problem you are pointing out, but I am not sure how "tracks the origin of content" could be a problem.

If output from "git show" says this:
	--- a/file
	+++ b/file
	@@ -1,5 +1,6 @@
	 a
	 b
	-c
	+C
	+D
	 d
	 e

in order to annotate lines 'a', 'b', 'd', and 'e' for their origin, you would run 'blame' on the commit the above output was taken from (or its parent---they are in the context so either would be OK).

You know where 'C' and 'D' came from already. It's the commit you are feeding "git show".

In order to run blame to find where 'c' came from, you need to start at the _parent_ of the commit the above output came from, and the hunk header shows which line range to find the final 'c'.

So...
Previous: Jeff KingNext: Jeff King
Message 3 of 8 in “difflame”
  1. Edmundo Carmona AntoranzJan 18, 2017
  2. Jeff KingJan 28, 2017
  3. Junio C HamanoJan 30, 2017
  4. Jeff KingJan 30, 2017
  5. Edmundo Carmona AntoranzJan 31, 2017
  6. Edmundo Carmona AntoranzJan 31, 2017
  7. Edmundo Carmona AntoranzFeb 3, 2017
  8. Edmundo Carmona AntoranzFeb 3, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.