From: Jeff King <peff@peff.net>
To: Matthieu Moy <Matthieu.Moy@imag.fr>
Cc: git@vger.kernel.org, gitster@pobox.com
Subject: Re: [PATCH 1/2] git-fast-import.txt: improve documentation for quoted paths
Date: Thu, 29 Nov 2012 13:11:42 -0500 [thread overview]
Message-ID: <20121129181141.GA17309@sigill.intra.peff.net> (raw)
In-Reply-To: <1354208455-21228-1-git-send-email-Matthieu.Moy@imag.fr>
On Thu, Nov 29, 2012 at 06:00:54PM +0100, Matthieu Moy wrote:
> The documentation mentionned only newlines and double quotes as
s/nn/n/
> diff --git a/Documentation/git-fast-import.txt b/Documentation/git-fast-import.txt
> index 6603a7a..35b909c 100644
> --- a/Documentation/git-fast-import.txt
> +++ b/Documentation/git-fast-import.txt
> @@ -558,8 +558,9 @@ A `<path>` string must use UNIX-style directory separators (forward
> slash `/`), may contain any byte other than `LF`, and must not
> start with double quote (`"`).
>
> -If an `LF` or double quote must be encoded into `<path>` shell-style
> -quoting should be used, e.g. `"path/with\n and \" in it"`.
> +If an `LF`, backslash or double quote must be encoded into `<path>`
> +shell-style quoting should be used, and the complete name should be
> +surrounded with double quotes e.g. `"path/with\n, \\ and \" in it"`.
I think the point of the original is that you do not _need_ to quote
unless you have those two characters. IOW, you can do:
M 100644 :1 file \with \backslashes
and it will stay in the "literal to the end of line" code path because
the path does not begin with a double-quote. It is only when you trigger
the "shell-style quoting" code path is in effect that you must then
follow the rules of that quoting (which includes escaping backslashes).
So technically, your modification to the beginning of the sentence is
not correct.
That being said, I think what you have written is more helpful to an end
user. There is no harm in quoting when we do not have to, as fast-import
implementations must know how to unquote anyway (and we over-quote in
fast-export in this case). And while the example above does work (and
was always designed to), it is sort of an unintuitive area that I would
not be surprised to see other fast-import implementations get wrong. As
a writer of a stream, it probably pays to be defensive and err on the
side of quoting more.
As for the text itself, a few minor punctuation suggestions:
> If an `LF`, backslash or double quote must be encoded
^
missing comma as list delimiter
> into `<path>` shell-style quoting should be used, and the complete
^
missing comma in if/then clause
This one was in the original as well, but it makes it harder to read and
is worth fixing.
> surrounded with double quotes e.g. `"path/with\n, \\ and \" in it"`.
Should the parenthetical be in parentheses (or a separate sentence)?
-Peff
next prev parent reply other threads:[~2012-11-29 18:12 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-29 12:33 [PATCH] git-remote-mediawiki: escape double quotes and LF in file names Matthieu Moy
2012-11-29 16:25 ` Junio C Hamano
2012-11-29 16:57 ` Matthieu Moy
2012-11-29 17:00 ` [PATCH 1/2] git-fast-import.txt: improve documentation for quoted paths Matthieu Moy
2012-11-29 17:00 ` [PATCH 2/2 v2] git-remote-mediawiki: escape ", \, and LF in file names Matthieu Moy
2012-11-29 18:11 ` Jeff King [this message]
2012-11-29 18:47 ` [PATCH 1/2] git-fast-import.txt: improve documentation for quoted paths Matthieu Moy
2012-11-29 18:54 ` Jeff King
2012-11-29 19:11 ` [PATCH 1/2 v3] " Matthieu Moy
2012-11-29 19:11 ` [PATCH 2/2 v3] git-remote-mediawiki: escape ", \, and LF in file names Matthieu Moy
2012-11-29 19:33 ` [PATCH 1/2 v3] git-fast-import.txt: improve documentation for quoted paths Junio C Hamano
2012-11-29 19:46 ` Jeff King
2012-11-29 19:15 ` [PATCH 1/2] " Junio C Hamano
2012-11-29 19:19 ` Jeff King
2012-11-30 9:39 ` Matthieu Moy
2012-12-02 2:27 ` 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=20121129181141.GA17309@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=Matthieu.Moy@imag.fr \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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).