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

Re: [PATCH v2] Do not show "diff --git" metainfo with --no-prefix

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 17, 2008, 02:28 UTC
Message-ID
<7vzlv5kwxy.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<alpine.LSU.1.00.0801170151040.17650@racer.site>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 11 quoted lines
>> No, what you are talking about is a need of negative prefix, which you 
>> did not implement in that no/src/dst-prefix patch.
>
> I'm probably missing something, but wouldn't a "diff --git gitk-git/gitk 
> gitk-git/gitk" instead of "diff --git a/gitk-git/gitk b/gitk-git/gitk" in 
> mbox format be directly grokkable by git-am?
>
>> Using --no-prefix is a _hack_ that may happen to work only when
>> the subtree-merged project is one level down.
>
> Yep.  But my point was more to show that it is still a valid git diff.  

My point was that the validness you mentined above is a happenstance, and not a result of a good design.

After I move gitk-git one level down to modules/gitk but before making it as a submodule, the output with --no-prefix will say "diff --git modules/gitk/gitk modules/gitk/gitk", and that will not be a suitable diff for Paul to apply to his tree.

I think he needs "-p2", but then he can already do that to diffs produced without using your --no-prefix that talks about "diff --git a/gitk-git/gitk b/gitk-git/gitk". IOW, --no-prefix is not a solution to anything.

And that is why I keep calling your "--no-prefix happens to work if you are only talking about a project that is subtree-merged one level down" argument a _hack_.

If we were to do this properly in "git diff", we would:
 - introduce a separate --strip-paths=1 (or whatever number of
   levels of leading prefix);
 - not use --{src,dst,no}-prefix
and you would do:
	$ git diff --strip-paths=1 gitk-git

in the current tree, which would first strip one path component and then do the usual opt->a_prefix/b_prefix thing to show:

	diff --git a/gitk b/gitk
Similarly you would run:
        $ git diff --strip-paths=2 modules/gitk
after I move gitk-git down one level.

An alternative would be to use the jc/diff-relative topic currently parked in 'offcuts' branch, and run:

	$ cd gitk-git && git diff .
or
	$ cd modules/gitk && git diff .
which would give diffs in relative paths.
Previous: Johannes SchindelinNext: Junio C Hamano
Message 33 of 53 in “[FEATURE REQUEST] git-svn format-patch”
  1. Chris OrtmanJan 15, 2008
  2. Johannes SchindelinJan 15, 2008
  3. Chris OrtmanJan 15, 2008
  4. Johannes SchindelinJan 15, 2008
  5. Chris OrtmanJan 15, 2008
  6. Johannes SchindelinJan 15, 2008
  7. Chris OrtmanJan 15, 2008
  8. Johannes SchindelinJan 15, 2008
  9. Chris OrtmanJan 15, 2008
  10. Jan HudecJan 15, 2008
  11. Miles BaderJan 16, 2008
  12. Shawn O. PearceJan 16, 2008
  13. Pascal ObryJan 15, 2008
  14. Daniel BarkalowJan 15, 2008
  15. Junio C HamanoJan 16, 2008
  16. Do not show "diff --git" metainfo with --no-prefixJunio C Hamano, Jan 16, 2008
  17. Johannes SchindelinJan 16, 2008
  18. Junio C HamanoJan 16, 2008
  19. Johannes SchindelinJan 16, 2008
  20. Daniel BarkalowJan 16, 2008
  21. Junio C HamanoJan 16, 2008
  22. Do not show "diff --git" metainfo with --no-prefixJunio C Hamano, Jan 16, 2008
  23. Linus TorvaldsJan 16, 2008
  24. Linus TorvaldsJan 16, 2008
  25. Daniel BarkalowJan 16, 2008
  26. Linus TorvaldsJan 16, 2008
  27. Junio C HamanoJan 16, 2008
  28. Daniel BarkalowJan 16, 2008
  29. Junio C HamanoJan 17, 2008
  30. Johannes SchindelinJan 17, 2008
  31. Junio C HamanoJan 17, 2008
  32. Johannes SchindelinJan 17, 2008
  33. Junio C HamanoJan 17, 2008
  34. Junio C HamanoJan 17, 2008
  35. Johannes SchindelinJan 17, 2008
  36. Junio C HamanoJan 17, 2008
  37. Johannes SchindelinJan 17, 2008
  38. Jeff KingJan 17, 2008
  39. Jeff KingJan 17, 2008
  40. Johannes SchindelinJan 17, 2008
  41. Jeff KingJan 17, 2008
  42. Junio C HamanoJan 18, 2008
  43. Junio C HamanoJan 16, 2008
  44. Daniel BarkalowJan 16, 2008
  45. Jan HudecJan 19, 2008
  46. Junio C HamanoJan 16, 2008
  47. Chris OrtmanJan 16, 2008
  48. Jean-Luc HerrenJan 15, 2008
  49. Chris OrtmanJan 15, 2008
  50. Daniel BarkalowJan 16, 2008
  51. Nigel MagnayMar 11, 2008
  52. Jan HudecMar 11, 2008
  53. Daniel BarkalowMar 12, 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.