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

Re: [PATCH] Make sure diff-helper can tell rename/copy in the new diff-raw format.

From
Junio C Hamano <junkio@cox.net>
Date
May 23, 2005, 18:43 UTC
Message-ID
<7vwtpp3hsa.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<Pine.LNX.4.58.0505230736180.2307@ppc970.osdl.org>
>>>>> "LT" == Linus Torvalds <torvalds@osdl.org> writes:

LT> Btw, I still disagree with this notion that the order of the LT> use of the names makes a difference.

Having slept over it, I think I tend to agree. I do not mind annotating diff-raw output with "is this copy or is this rename" bit anymore. While we are at it, I would also want to either (1) add similarity index field to diff-raw output, or (2) drop similarity index output from the built-in patch output. I am inclined to vote for the former right now (if only it is more fun to watch), but I can easily be dissuaded.

The proposed diff-raw format, in its fully expended form, is this:

in-place edit :100644 100644 bcd1234... 0123456... file0 file0 . 0 copy-edit :100644 100644 abcd123... 1234567... file1 file2 C 68 rename-edit :100644 100644 abcd123... 1234567... file1 file3 R 86 create :000000 100644 0000000... 1234567... file4 file4 . 0 delete :100644 000000 1234567... 0000000... file5 file5 . 0 unmerged :000000 000000 0000000... 0000000... file6 file6 . 0

The two columns added are rename/copy bit and similarity index. When one->path and two->path are the same, they do not mean anything but for parser simplicity's sake I'd like to have 0 in the similarity index field and a dot in copy/rename bit field.

Human readable form should omit two->path and later fields altogether if one->path == two->path, so the above becomes:

in-place edit :100644 100644 bcd1234... 0123456... file0 copy-edit :100644 100644 abcd123... 1234567... file1 file2 C 68 rename-edit :100644 100644 abcd123... 1234567... file1 file3 R 86 create :000000 100644 0000000... 1234567... file4 delete :100644 000000 1234567... 0000000... file5 unmerged :000000 000000 0000000... 0000000... file6

This has a nice property that diff-helper, aside from its diff-raw parsing part, can become quite simplified. It should lose rename/copy related flags (-M, -C) because they are already detected by the tool in the upstream of the pipe; and because rename-copy is an asymmetric operation, it should also lose the -R flag. I think it already does a wrong thing when you use diff-tree brothers with -M or -C and feed diff-helper -R with the output that contains already matched rename/copy.

The only thing diff-helper _will_ continue to do is to take a diff-raw output prepared by diff-tree brothers, and generate what the upstream tool would have generated if it were given '-p' (and that should have been the case from the beginning).

Although I think diffcore transformers other than rename/copy may still be useful (like pickaxe) in diff-helper, that also can be handled upstream.

Previous: Linus TorvaldsNext: Linus Torvalds
Message 3 of 20 in “Make sure diff-helper can tell rename/copy in the new diff-raw format.”
  1. Make sure diff-helper can tell rename/copy in the new diff-raw format.Junio C Hamano, May 23, 2005
  2. Linus TorvaldsMay 23, 2005
  3. Junio C HamanoMay 23, 2005
  4. Linus TorvaldsMay 23, 2005
  5. Linus TorvaldsMay 23, 2005
  6. diff-raw format update take #2.Junio C Hamano, May 23, 2005
  7. diff-raw format update take #2.Junio C Hamano, May 23, 2005
  8. Chris WedgwoodMay 24, 2005
  9. Junio C HamanoMay 24, 2005
  10. Chris WedgwoodMay 24, 2005
  11. Junio C HamanoMay 24, 2005
  12. Linus TorvaldsMay 24, 2005
  13. Chris WedgwoodMay 24, 2005
  14. David LangMay 24, 2005
  15. Chris WedgwoodMay 24, 2005
  16. Thomas GlanzmannMay 24, 2005
  17. Linus TorvaldsMay 24, 2005
  18. Linus TorvaldsMay 24, 2005
  19. Junio C HamanoMay 26, 2005
  20. Thomas GlanzmannMay 24, 2005

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.