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

From: Jakub Narebski <[email-masked]>
Date: Thu, 8 Jul 2010 14:19:42 +0200

On Thu, 8 Jul 2010, Jeff King wrote:
> On Thu, Jul 08, 2010 at 01:00:17PM +0200, Jakub Narebski wrote:
> 
> > Last there is filename munging, done using strip_prefix function.
> > This is done using prefix_length only, and that is the cause of
> > the bug:
> >   $ git diff-tree --abbrev -r --raw HEAD --relative=sub
> >   a3a8425fe5496c61921010cb1e7b455a1f52bb86
> >   :100644 100644 d90bda0... cefcae0... M	/quux
> > 
> > if one uses '--relative=sub' instead of '--relative=sub/'.
> 
> Is that a bug or a feature? You need to say "sub/" to get what you want,
> which is annoying. But it means you can also you "--relative=su" to get
> "b/quux". In that example, it's probably useless, but consider a set of
> filenames "foo-1" through "foo-5". You don't always want to break on a
> directory boundary.
> 
> I believe "git-archive --prefix" has the same behavior for the same
> reason.

Nevertheless for the patch output format both "git diff --relative=sub"
and "git diff --relative=sub/" give the same output, without 'b//quux'.
The same IMHO should be done for raw output format, so we don't have
'/quux' but 'quux'.

-- 
Jakub Narebski
Poland