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

Re: Call Me Gitless

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 19, 2008, 06:47 UTC
Message-ID
<7vmyj9h567.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<48AA4430.3060207@gmail.com>
Marcus Griep <neoeinstein@gmail.com> writes:
Show 17 quoted lines
> Junio C Hamano wrote:
>
>> This implements Daniel's idea to indicate what are compared by using
>> prefix different from the traditional a/ and b/ in the textual diff
>> header:
>> 
>>     "git diff" compares the (i)ndex and the (w)ork tree;
>>     "git diff HEAD" compares a (c)ommit and the (w)ork tree;
>>     "git diff --cached" compares a (c)ommit and the (i)ndex;
>>     "git diff HEAD:f /tmp/f" compares an (o)bject and (w)ork tree.
>> 
>> Because these mnemonics now have meanings, they are swapped when reverse
>> diff is in effect.
>
> I like this proposal-ish; making the prefixes more intuitive could be
> useful when looking at a bare diff from git too.  I'd put some time in
> to help implement this.

What I did not bother in the patch is --no-index codepath, but with the recent refactoring of it to separate it out from the normal "index vs work tree" codepath, I would expect it to be trivial to use "1/" vs "2/" (or "old/" and "new/") prefixes for them. I didn't actually look, though.

I also left "-c" and "--cc" unmodified. Daniel's "have many patches to apply, but cannot readily tell in which direction they were generated" use-case won't involve them, and reverse diff won't make sense with --cc, so that should be Ok.

And obviously I didn't adjust the test vectors and documentation, which is needed if somebody is serious enough about actually making this part of the official system.

But be warned that this has two downsides, one minor, and one rather major:

 * Using non-standard prefix affects git-patch-id output.  This would not
   affect "git-format-patch --ignore-if-in-upstream", "git-cherry",
   "git-rebase" because they all use internal patch-id generation, but
   third party scripts that feed patches to "git-patch-id" and compare its
   output with precomputed patch-id database to cull duplicates will be
   affected.
 * Similarly, scripts that assume more about "git diff" output than that
   they are meant to be applied with depth 1 may break.
   I think gitweb would be Ok, because I do not think it would try parsing
   a textual diff, stripping out a/ (or b/), to figure out the paths being
   affected.  Even if it did, it would be doing two-tree form (iow, it
   does not use working tree at all) which I deliberately kept to use a/
   vs b/ with my patch, so it should be fine.  I do not offhand recall how
   cvsserver generates its diff output, but it would also be fine as the
   server side would do two-tree form and nothing else.
   But nobody knows what third-party scripts are assuming.  They may be
   parsing the pathnames, stripping a/ and b/ away.
Previous: Marcus GriepNext: Junio C Hamano
Message 14 of 67 in “Call Me Gitless”
  1. TransAug 18, 2008
  2. Benjamin SergeantAug 18, 2008
  3. Martin LanghoffAug 18, 2008
  4. Pascal ObryAug 18, 2008
  5. Jon LoeligerAug 18, 2008
  6. Daniel BarkalowAug 18, 2008
  7. Marcus GriepAug 18, 2008
  8. Junio C HamanoAug 18, 2008
  9. Daniel BarkalowAug 18, 2008
  10. Junio C HamanoAug 18, 2008
  11. Daniel BarkalowAug 18, 2008
  12. Junio C HamanoAug 19, 2008
  13. Marcus GriepAug 19, 2008
  14. Junio C HamanoAug 19, 2008
  15. Junio C HamanoAug 19, 2008
  16. diff: vary default prefix depending on what are comparedJunio C Hamano, Aug 20, 2008
  17. Jakub NarebskiAug 20, 2008
  18. Stephen R. van den BergAug 19, 2008
  19. Jakub NarebskiAug 19, 2008
  20. Junio C HamanoAug 19, 2008
  21. Jeff KingAug 19, 2008
  22. Daniel BarkalowAug 19, 2008
  23. Jeff KingAug 19, 2008
  24. Daniel BarkalowAug 19, 2008
  25. Jeff KingAug 19, 2008
  26. Daniel BarkalowAug 19, 2008
  27. Petr BaudisAug 19, 2008
  28. Daniel BarkalowAug 19, 2008
  29. Junio C HamanoAug 19, 2008
  30. Junio C HamanoAug 19, 2008
  31. Daniel BarkalowAug 19, 2008
  32. Sverre Hvammen JohansenAug 21, 2008
  33. Junio C HamanoAug 21, 2008
  34. 1/3 sha1_object_info(): pay attention to cached objectsJunio C Hamano, Aug 21, 2008
  35. 2/3 cached_object: learn empty blobJunio C Hamano, Aug 21, 2008
  36. 3/3 git-add --intent-to-add (-N)Junio C Hamano, Aug 21, 2008
  37. Paolo BonziniAug 21, 2008
  38. Jonathan NiederAug 21, 2008
  39. Jonathan NiederAug 22, 2008
  40. Daniel BarkalowAug 22, 2008
  41. Junio C HamanoAug 22, 2008
  42. Jonathan NiederAug 22, 2008
  43. Junio C HamanoAug 22, 2008
  44. Jonathan NiederAug 22, 2008
  45. Jonathan NiederAug 22, 2008
  46. Daniel BarkalowAug 21, 2008
  47. TarmiganAug 18, 2008
  48. Daniel BarkalowAug 19, 2008
  49. TarmiganAug 19, 2008
  50. Peter Valdemar Mørch (Lists)Aug 19, 2008
  51. Junio C HamanoAug 19, 2008
  52. Imran M YousufAug 19, 2008
  53. Peter Valdemar Mørch (Lists)Aug 19, 2008
  54. Imran M YousufAug 19, 2008
  55. Alexander E GenaudAug 19, 2008
  56. Matthieu MoyAug 19, 2008
  57. Mike HommeyAug 19, 2008
  58. Alexander E GenaudAug 19, 2008
  59. Pascal ObryAug 19, 2008
  60. Paolo BonziniAug 21, 2008
  61. Elijah NewrenAug 22, 2008
  62. Peter Valdemar Mørch (Lists)Aug 19, 2008
  63. Mark StrubergAug 19, 2008
  64. Alexander E GenaudAug 19, 2008
  65. Junio C HamanoAug 19, 2008
  66. Teemu LikonenAug 19, 2008
  67. Jakub NarebskiAug 19, 2008

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.