Git development
 help / color / mirror / Atom feed
* filenames with " b" in them create confusing git diff-tree output
@ 2007-06-20 11:15 Paul Mackerras
  2007-06-20 19:59 ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Mackerras @ 2007-06-20 11:15 UTC (permalink / raw)
  To: Junio C Hamano, git

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.

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-06-20 20:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-20 11:15 filenames with " b" in them create confusing git diff-tree output Paul Mackerras
2007-06-20 19:59 ` Junio C Hamano
2007-06-20 20:23   ` Linus Torvalds
2007-06-20 20:50     ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox