git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Filename quoting / parsing problem
@ 2010-01-01 17:44 Andreas Gruenbacher
  2010-01-01 19:50 ` Junio C Hamano
  0 siblings, 1 reply; 10+ messages in thread
From: Andreas Gruenbacher @ 2010-01-01 17:44 UTC (permalink / raw)
  To: git

Git quotes file names as documented in the git-diff manual page:

  TAB, LF, double quote and backslash characters in pathnames are represented
  as \t, \n, \" and \\, respectively.  If there is need for such substitution
  then the whole pathname is put in double quotes.

Spaces in file names currently do not trigger quoting.  (And \r triggers 
quoting even though the man page doesn't say so).  When there are no "---" and 
"+++" lines, this can lead to a parsing problem: only the "diff --git" line 
contains the file names, sometimes with insufficient quoting.  The following 
examples show the problem:

Parseable:
    diff --git "a/foo \r" "b/foo \r"
    new file mode 100644
    index 0000000..257cc56
    --- /dev/null
    +++ "b/foo \r"
    @@ -0,0 +1 @@
   +foo

Parseable:
    diff --git a/bar  b/bar 
    new file mode 100644
    index 0000000..5716ca5
    --- /dev/null
    +++ b/bar 
    @@ -0,0 +1 @@
    +bar

Not parseable:
    diff --git a/baz  b/baz 
    new file mode 100644
    index 0000000..e69de29


Could this please be changed so that filenames with spaces are also quoted, at 
least in the "diff --git" line, and possibly also in the "---" and "+++" 
lines?  Alternatively, how about a new extended header with the file name in 
this particular case?

Thanks,
Andreas

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

end of thread, other threads:[~2010-01-09 12:39 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-01 17:44 Filename quoting / parsing problem Andreas Gruenbacher
2010-01-01 19:50 ` Junio C Hamano
2010-01-01 20:01   ` Junio C Hamano
2010-01-02 11:36     ` Andreas Gruenbacher
2010-01-02 18:37       ` Junio C Hamano
2010-01-02 20:48         ` Andreas Gruenbacher
2010-01-06  0:04           ` Andreas Gruenbacher
2010-01-06  1:32             ` Junio C Hamano
2010-01-06  1:08           ` Junio C Hamano
2010-01-06 10:06             ` Andreas Schwab

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