Git development
 help / color / mirror / Atom feed
From: Paul Mackerras <paulus@samba.org>
To: Junio C Hamano <junkio@cox.net>, git@vger.kernel.org
Subject: filenames with " b" in them create confusing git diff-tree output
Date: Wed, 20 Jun 2007 21:15:39 +1000	[thread overview]
Message-ID: <18041.3163.329391.298926@cargo.ozlabs.ibm.com> (raw)

While trying to improve gitk's handling of filenames with spaces, I
realised that the header line in git diff-tree's output can be
inherently ambiguous, since it doesn't put quotes around filenames
with spaces (although it does for filenames with other special
characters in them).

For example:

paulus@quango:~/gitk/testrepo$ mkdir "test b"
paulus@quango:~/gitk/testrepo$ cat >"test b/foo"
stuff
paulus@quango:~/gitk/testrepo$ git add "test b/foo"
paulus@quango:~/gitk/testrepo$ git commit -a
Created commit 71a3074: Add a "test b" directory
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 test b/foo
paulus@quango:~/gitk/testrepo$ git diff-tree -r -p -C HEAD
71a3074e723c3e5eb599e6b3c47e3267a3cac3bc
diff --git a/test b/foo b/test b/foo
new file mode 100644
index 0000000..f2e4113
--- /dev/null
+++ b/test b/foo
@@ -0,0 +1 @@
+stuff

Note how there appear to be 4 filenames on the "diff --git" line.  At
present gitk will interpret that as a diff between "test" and
"foo b/test b/foo", since it looks for " a/" and " b/" to delimit the
filenames.  Of course if the file got renamed it could get even more
confusing. :)

Would there be any ill effects from quoting filenames with spaces, do
you think?  It seems the simplest fix to me (and I will make gitk
handle quoted filenames, which it doesn't at present :).

Paul.

             reply	other threads:[~2007-06-20 11:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-20 11:15 Paul Mackerras [this message]
2007-06-20 19:59 ` filenames with " b" in them create confusing git diff-tree output Junio C Hamano
2007-06-20 20:23   ` Linus Torvalds
2007-06-20 20:50     ` Junio C Hamano

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=18041.3163.329391.298926@cargo.ozlabs.ibm.com \
    --to=paulus@samba.org \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /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