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

Re: [BUG/RFC] Raw diff output format (git-diff-tree) and --relative[=<path>] option

From
Jeff King <peff@peff.net>
Date
Aug 9, 2010, 14:59 UTC
Message-ID
<20100809145956.GB3438@sigill>
In-Reply-To
<201007081656.23474.jnareb@gmail.com>
On Thu, Jul 08, 2010 at 04:56:20PM +0200, Jakub Narebski wrote:
Show 10 quoted lines
> > Or was that what you had in mind the whole time? My impression was that
> > you wanted --relative=foo to always be equivalent to --relative=foo/.
> > The subtle difference is that I want the "/" removed only if it is the
> > next character (or another way of thinking about it is to append "/" to
> > the prefix only if it is an actual directory).
> 
> What I wanted is for "git diff-tree A B --relative=sub" to behave as
> "git diff-tree A:sub B:sub".  Currently without -r / -t (without turning
> on recursive mode) it produces no output; well at least no output if
> 'sub' is really subdirectory.

I think this is a separate issue from the extra slash problem. I don't think it would hurt anything to enable "-r" automatically in diff-tree, but _only_ if we know that the prefix we stripped ended in "/". Since that is just changing a case that is already nonsensical, whereas turning on recursion for "git diff-tree --relative=foo- A B" would actually be a change in behavior.

It should be possible, but it is a bit more surgery, since the prefix stripping code is pretty dumb currently.

> What's more I wanted for "git diff --raw" in any combination to behave
> the same... although I guess here point is moot, as "git diff" is
> automatically recursive regardless of output format, and you can't turn
> it off.

Yeah, I think "git diff" already does what you want, since 82cb8af (git-diff: turn on recursion by default, 2007-07-29).

-Peff
Previous: Jeff King
Message 10 of 10 in “[BUG] Spurious leading '/' in filename in "git diff --raw --relative=<subdirectory>"”
  1. Jakub NarebskiJul 5, 2010
  2. Jakub NarebskiJul 5, 2010
  3. [BUG/RFC] Raw diff output format (git-diff-tree) and --relative[=<path>] optionJakub Narebski, Jul 8, 2010
  4. Jeff KingJul 8, 2010
  5. Jakub NarebskiJul 8, 2010
  6. Jakub NarebskiJul 8, 2010
  7. Jeff KingJul 8, 2010
  8. Jakub NarebskiJul 8, 2010
  9. Jeff KingAug 9, 2010
  10. Jeff KingAug 9, 2010

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.