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

Re: [PATCH] Resurrect diff-tree-helper -R

From
Junio C Hamano <junkio@cox.net>
Date
May 14, 2005, 00:33 UTC
Message-ID
<7voebe63zs.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<7vmzqy7k47.fsf@assigned-by-dhcp.cox.net>

Another possibility. How about generating the following _only_ when mode changes (including create and delete), even for human consumption? There will be _no_ such line when mode or type does not change.

# mode: 100644 100755 path/to/a/file/that/changed/mode # mode: 100644 120000 path/to/a/file/that/changed/to/symlink # mode: 100644 100644 path/to/a/file/with/no/mode/change # mode: . 100644 path/to/a/new/file # mode: 100644 . path/to/a/deleted/file

This is not "something like this", but a proposal for the exact output format specification (I am going to code immediately). Each token above is separated with exactly one ' ' (ASCII 0x20) each, and such a line comes immediately before the patch for the file. Showing both mode bits is to prepare for the case you would want to apply the patch in reverse.

This is for machine consumption and there is no need to force them to parse out -> and (), so I dropped them. And mode or type change happens so rarely, it would be OK for human consumption if we show these garbage (from human point of view) only when things change. Can you parse this, or do you always want to have them even if nothing changes?

Let's see how this would look like to humans.
    # mode: 100644 100755 path0
    --- a/path0
    +++ b/path0
    @@ -1,3 +1,3 @@
     Line 1
     Line 2
    -line 3
    +Line 3
    # mode: 100644 . path1
    --- a/path1
    +++ /dev/null
    @@ -1,3 +0,0 @@
    -Line 1
    -Line 2
    -line 3
    --- a/path2
    +++ b/path2
    @@ -1,3 +1,3 @@
     Line 1
     Line 2
    -line 3
    +Line 3
    # mode: . 100755 t/t2000-diff.sh
    --- /dev/null
    +++ b/t/t2000-diff.sh
    @@ -0,0 +1,41 @@
    ...
Doesn't look too bad, does it?
Previous: Junio C HamanoNext: Petr Baudis
Message 15 of 25 in “Resurrect diff-tree-helper -R”
  1. Resurrect diff-tree-helper -RJunio C Hamano, May 1, 2005
  2. Linus TorvaldsMay 1, 2005
  3. Daniel JacobowitzMay 1, 2005
  4. Linus TorvaldsMay 1, 2005
  5. Junio C HamanoMay 1, 2005
  6. Linus TorvaldsMay 1, 2005
  7. Junio C HamanoMay 1, 2005
  8. Add git-apply-patch-script.Junio C Hamano, May 1, 2005
  9. Rework built-in diff to make its output more dense.Junio C Hamano, May 1, 2005
  10. Petr BaudisMay 13, 2005
  11. Junio C HamanoMay 13, 2005
  12. Junio C HamanoMay 13, 2005
  13. Petr BaudisMay 13, 2005
  14. Junio C HamanoMay 13, 2005
  15. Junio C HamanoMay 14, 2005
  16. Petr BaudisMay 14, 2005
  17. Junio C HamanoMay 14, 2005
  18. Petr BaudisMay 14, 2005
  19. Junio C HamanoMay 15, 2005
  20. Petr BaudisMay 15, 2005
  21. Junio C HamanoMay 15, 2005
  22. Tweak diff output further to make it a bit less distracting.Junio C Hamano, May 15, 2005
  23. Petr BaudisMay 14, 2005
  24. Junio C HamanoMay 14, 2005
  25. Junio C HamanoMay 13, 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.