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

Re: Introduction and Wikipedia and Git Blame

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 16, 2009, 17:04 UTC
Message-ID
<7vbpk7w9qx.fsf@alter.siamese.dyndns.org>
In-Reply-To
<alpine.DEB.1.00.0910161548550.4985@pacific.mpi-cbg.de>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 9 quoted lines
> Then I would make modified "texts" from the blob of the file in the 
> current revision and its parent revision, by inserting newlines after 
> every single byte (probably replacing the original newlines by other 
> values, such as \x01).
>
> The reason for this touchup is that the diff machinery in Git only handles 
> line-based diffs.
>
> Then you can parse the hunk headers, adjust the offsets accordingly,...

I would agree that text converted to "byte-per-line" format would be the easiest way to re-use the diff engine, but if you go one more step, you can even reusel the blame engine as well. You convert the text into "byte-in-hex-and-lf" (e.g. "AB C\n" becomes "41\n42\n20\n43\n0a\n") and feed it into existing blame and have it produce script-readable output, instead of feeding that to your reinvention of blame using diff engine.

You would need to postprocess the computed result (either by diff or blame) to lay out the final text output in either case anyway, and making the existing blame engine do the work for you would be a better approach, I think.

Previous: jamesmikedupont@googlemail.comNext: jamesmikedupont@googlemail.com
Message 7 of 15 in “Introduction and Wikipedia and Git Blame”
  1. jamesmikedupont@googlemail.comOct 16, 2009
  2. Johannes SchindelinOct 16, 2009
  3. Martin LanghoffOct 16, 2009
  4. jamesmikedupont@googlemail.comOct 16, 2009
  5. Johannes SchindelinOct 16, 2009
  6. jamesmikedupont@googlemail.comOct 16, 2009
  7. Junio C HamanoOct 16, 2009
  8. jamesmikedupont@googlemail.comOct 16, 2009
  9. Junio C HamanoOct 16, 2009
  10. Junio C HamanoOct 16, 2009
  11. jamesmikedupont@googlemail.comOct 16, 2009
  12. Junio C HamanoOct 16, 2009
  13. jamesmikedupont@googlemail.comOct 17, 2009
  14. jamesmikedupont@googlemail.comOct 17, 2009
  15. jamesmikedupont@googlemail.comOct 22, 2009

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.