git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Gruenbacher <agruen@suse.de>
To: git@vger.kernel.org
Subject: Filename quoting / parsing problem
Date: Fri, 1 Jan 2010 18:44:23 +0100	[thread overview]
Message-ID: <201001011844.23571.agruen@suse.de> (raw)

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

             reply	other threads:[~2010-01-01 17:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-01 17:44 Andreas Gruenbacher [this message]
2010-01-01 19:50 ` Filename quoting / parsing problem 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

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=201001011844.23571.agruen@suse.de \
    --to=agruen@suse.de \
    --cc=git@vger.kernel.org \
    /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).