git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Jakub Narebski <jnareb@gmail.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: Re: [BUG/RFC] Raw diff output format (git-diff-tree) and --relative[=<path>] option
Date: Thu, 8 Jul 2010 10:23:41 -0400	[thread overview]
Message-ID: <20100708142341.GA9991@coredump.intra.peff.net> (raw)
In-Reply-To: <201007081419.42702.jnareb@gmail.com>

On Thu, Jul 08, 2010 at 02:19:42PM +0200, Jakub Narebski wrote:

> 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'.

Hmm. That is because the diff output properly eliminates the double "/".
But AFAICT, all of the following do what I would expect:

  git diff --relative=sub
  git diff --relative=sub/ ;# same as above
  git diff --relative=foo- ;# yields "a/10" for file "foo-10"

Doing

  git diff --relative=sub --stat

shows the same issue as your --raw version, as does --name-only. I think
the right solution is to clean up a leading "/" for those cases. That
leaves the possibility for non-directory prefixes, but should do what
the user wants in the directory case (since a leading "/" is
nonsensical).

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).

-Peff

  reply	other threads:[~2010-07-08 14:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-05  8:15 [BUG] Spurious leading '/' in filename in "git diff --raw --relative=<subdirectory>" Jakub Narebski
2010-07-05 15:44 ` Jakub Narebski
2010-07-08 11:00   ` [BUG/RFC] Raw diff output format (git-diff-tree) and --relative[=<path>] option Jakub Narebski
2010-07-08 11:41     ` Jeff King
2010-07-08 12:11       ` Jakub Narebski
2010-07-08 12:19       ` Jakub Narebski
2010-07-08 14:23         ` Jeff King [this message]
2010-07-08 14:56           ` Jakub Narebski
2010-08-09 14:50             ` Jeff King
2010-08-09 14:59             ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100708142341.GA9991@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jnareb@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).