git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Thalia Archibald <thalia@archibald.dev>
Cc: git@vger.kernel.org,  Patrick Steinhardt <ps@pks.im>,
	 Chris Torek <chris.torek@gmail.com>,
	 Elijah Newren <newren@gmail.com>
Subject: Re: [PATCH v3 5/8] fast-import: improve documentation for unquoted paths
Date: Thu, 11 Apr 2024 12:51:41 -0700	[thread overview]
Message-ID: <xmqq5xwnu182.fsf@gitster.g> (raw)
In-Reply-To: <2e78690023f653436ec2eba0c5fb9dfa6bb62624.1712741871.git.thalia@archibald.dev> (Thalia Archibald's message of "Wed, 10 Apr 2024 09:55:56 +0000")

Thalia Archibald <thalia@archibald.dev> writes:

> It describes what cannot be in an unquoted path, but not what it is.
> Reframe it as a definition of unquoted paths. The requirement that it
> not start with `"` is the core element that implies the rest.

The other is that a path with LF in it cannot be written unquoted,
which should be treated the same way as ones that begin with dq in
this explanation, I think.

> The restriction that the source paths of filecopy and filerename cannot
> contain SP is only stated in their respective sections. Restate it in
> the <path> section.

Elsewhere later in the series we clarify that NUL cannot appear in a
path, so the above looks perfect at this point in the series.

> Signed-off-by: Thalia Archibald <thalia@archibald.dev>
> ---
>  Documentation/git-fast-import.txt | 19 ++++++++++++-------
>  1 file changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/Documentation/git-fast-import.txt b/Documentation/git-fast-import.txt
> index b2607366b9..f26d7a8571 100644
> --- a/Documentation/git-fast-import.txt
> +++ b/Documentation/git-fast-import.txt
> @@ -630,18 +630,23 @@ in octal.  Git only supports the following modes:
>  In both formats `<path>` is the complete path of the file to be added
>  (if not already existing) or modified (if already existing).
>  
> -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 (`"`).
>  
> -A path can use C-style string quoting; this is accepted in all cases
> -and mandatory if the filename starts with double quote or contains
> -`LF`. In C-style quoting, the complete name should be surrounded with

> +A `<path>` can be written as unquoted bytes or a C-style quoted string:

If it is followed by two-bullet-point enumeration (one for unquoted,
the other for quoted), then sentence ending in a colon here is
perfectly fine, but we are not doing so in the next two paragraphs,
so let's give it a normal full-stop (period).  And make it a
paragraph on its own, which you did correctly.

> +When a `<path>` does not start with double quote (`"`), it is an
> +unquoted string and is parsed as literal bytes without any escape
> +sequences. However, if the filename contains `LF` or starts with double
> +quote, it must be written as a quoted string. Additionally, the source
> +`<path>` in `filecopy` or `filerename` must be quoted if it contains SP.

As the description for <path> in filecopy and filerename refers back
to this description, this "Additionally" is a good clarification to
have here.  Nicely done.

> +A `<path>` can use C-style string quoting; this is accepted in all cases
> +and mandatory in the cases where the filename cannot be represented as
> +an unquoted string. In C-style quoting, the complete name should be surrounded with

I somehow think the early part (before "In C-style quoting") is
redundant and unnecessary, as we started the section with "as
unquoted bytes or a C-style quoted string."  As the previous
paragraph about unquoted path begins with "When a <path> does not
start with a double quote", I would have expected this paragraph to
begin like so:

	When a `<path>` begins with a double quote (`"`), it is a
	C-style quoted string, where the complete name is enclosed
	in a pair of double quotes, and ...

>  double quotes, and any `LF`, backslash, or double quote characters
>  must be escaped by preceding them with a backslash (e.g.,
>  `"path/with\n, \\ and \" in it"`).
>  
> -The value of `<path>` must be in canonical form. That is it must not:
> +A `<path>` must use UNIX-style directory separators (forward slash `/`)
> +and must be in canonical form. That is it must not:
>  
>  * contain an empty directory component (e.g. `foo//bar` is invalid),
>  * end with a directory separator (e.g. `foo/` is invalid),

Thanks.


  reply	other threads:[~2024-04-11 19:51 UTC|newest]

Thread overview: 84+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-22  0:03 [PATCH 0/6] fast-import: tighten parsing of paths Thalia Archibald
2024-03-22  0:03 ` [PATCH 1/6] " Thalia Archibald
2024-03-22  0:11   ` Thalia Archibald
2024-03-28  8:21   ` Patrick Steinhardt
     [not found]     ` <E01C617F-3720-42C0-83EE-04BB01643C86@archibald.dev>
2024-04-01  9:05       ` Thalia Archibald
2024-03-22  0:03 ` [PATCH 2/6] fast-import: directly use strbufs for paths Thalia Archibald
2024-03-28  8:21   ` Patrick Steinhardt
2024-03-22  0:03 ` [PATCH 3/6] fast-import: release unfreed strbufs Thalia Archibald
2024-03-28  8:21   ` Patrick Steinhardt
2024-04-01  9:06     ` Thalia Archibald
2024-03-22  0:03 ` [PATCH 4/6] fast-import: remove dead strbuf Thalia Archibald
2024-03-28  8:21   ` Patrick Steinhardt
2024-03-22  0:03 ` [PATCH 5/6] fast-import: document C-style escapes for paths Thalia Archibald
2024-03-28  8:21   ` Patrick Steinhardt
2024-04-01  9:06     ` Thalia Archibald
2024-03-22  0:03 ` [PATCH 6/6] fast-import: forbid escaped NUL in paths Thalia Archibald
2024-04-01  9:02 ` [PATCH v2 0/8] fast-import: tighten parsing of paths Thalia Archibald
2024-04-01  9:02   ` [PATCH v2 1/8] fast-import: tighten path unquoting Thalia Archibald
2024-04-10  6:27     ` Patrick Steinhardt
2024-04-10  8:18       ` Chris Torek
2024-04-10  8:44         ` Thalia Archibald
2024-04-10  8:51           ` Chris Torek
2024-04-10  9:14             ` Thalia Archibald
2024-04-10  9:42               ` Patrick Steinhardt
2024-04-10  9:16             ` Thalia Archibald
2024-04-10  9:12       ` Thalia Archibald
2024-04-01  9:03   ` [PATCH v2 2/8] fast-import: directly use strbufs for paths Thalia Archibald
2024-04-10  6:27     ` Patrick Steinhardt
2024-04-10 10:07       ` Thalia Archibald
2024-04-10 10:18         ` Patrick Steinhardt
2024-04-01  9:03   ` [PATCH v2 3/8] fast-import: allow unquoted empty path for root Thalia Archibald
2024-04-10  6:27     ` Patrick Steinhardt
2024-04-01  9:03   ` [PATCH v2 4/8] fast-import: remove dead strbuf Thalia Archibald
2024-04-01  9:03   ` [PATCH v2 5/8] fast-import: improve documentation for unquoted paths Thalia Archibald
2024-04-01  9:03   ` [PATCH v2 6/8] fast-import: document C-style escapes for paths Thalia Archibald
2024-04-01  9:03   ` [PATCH v2 7/8] fast-import: forbid escaped NUL in paths Thalia Archibald
2024-04-01  9:03   ` [PATCH v2 8/8] fast-import: make comments more precise Thalia Archibald
2024-04-07 21:19   ` [PATCH v2 0/8] fast-import: tighten parsing of paths Thalia Archibald
2024-04-07 23:46     ` Eric Sunshine
2024-04-08  6:25       ` Patrick Steinhardt
2024-04-08  7:15         ` Thalia Archibald
2024-04-08  9:07           ` Patrick Steinhardt
2024-04-08 14:52         ` Junio C Hamano
2024-04-10  9:54   ` [PATCH v3 " Thalia Archibald
2024-04-10  9:55     ` [PATCH v3 1/8] fast-import: tighten path unquoting Thalia Archibald
2024-04-10  9:55     ` [PATCH v3 2/8] fast-import: directly use strbufs for paths Thalia Archibald
2024-04-10  9:55     ` [PATCH v3 3/8] fast-import: allow unquoted empty path for root Thalia Archibald
2024-04-11 19:59       ` Junio C Hamano
2024-04-10  9:55     ` [PATCH v3 4/8] fast-import: remove dead strbuf Thalia Archibald
2024-04-11 19:53       ` Junio C Hamano
2024-04-10  9:55     ` [PATCH v3 5/8] fast-import: improve documentation for unquoted paths Thalia Archibald
2024-04-11 19:51       ` Junio C Hamano [this message]
2024-04-10  9:56     ` [PATCH v3 6/8] fast-import: document C-style escapes for paths Thalia Archibald
2024-04-10 18:28       ` Junio C Hamano
2024-04-10 22:50         ` Thalia Archibald
2024-04-11  5:32           ` Junio C Hamano
2024-04-11  9:14             ` Patrick Steinhardt
2024-04-10  9:56     ` [PATCH v3 7/8] fast-import: forbid escaped NUL in paths Thalia Archibald
2024-04-10 18:51       ` Junio C Hamano
2024-04-10  9:56     ` [PATCH v3 8/8] fast-import: make comments more precise Thalia Archibald
2024-04-10 19:21       ` Junio C Hamano
2024-04-12  8:01     ` [PATCH v4 0/8] fast-import: tighten parsing of paths Thalia Archibald
2024-04-12  8:02       ` [PATCH v4 1/8] fast-import: tighten path unquoting Thalia Archibald
2024-04-12 16:34         ` Junio C Hamano
2024-04-13  0:07           ` Thalia Archibald
2024-04-13 18:33             ` Junio C Hamano
2024-04-12  8:03       ` [PATCH v4 2/8] fast-import: directly use strbufs for paths Thalia Archibald
2024-04-12  8:03       ` [PATCH v4 3/8] fast-import: allow unquoted empty path for root Thalia Archibald
2024-04-12  8:03       ` [PATCH v4 4/8] fast-import: remove dead strbuf Thalia Archibald
2024-04-12  8:03       ` [PATCH v4 5/8] fast-import: improve documentation for path quoting Thalia Archibald
2024-04-12  8:03       ` [PATCH v4 6/8] fast-import: document C-style escapes for paths Thalia Archibald
2024-04-12  8:03       ` [PATCH v4 7/8] fast-import: forbid escaped NUL in paths Thalia Archibald
2024-04-12  8:03       ` [PATCH v4 8/8] fast-import: make comments more precise Thalia Archibald
2024-04-14  1:11       ` [PATCH v5 0/8] fast-import: tighten parsing of paths Thalia Archibald
2024-04-14  1:11         ` [PATCH v5 1/8] fast-import: tighten path unquoting Thalia Archibald
2024-04-14  1:11         ` [PATCH v5 2/8] fast-import: directly use strbufs for paths Thalia Archibald
2024-04-14  1:11         ` [PATCH v5 3/8] fast-import: allow unquoted empty path for root Thalia Archibald
2024-04-14  1:11         ` [PATCH v5 4/8] fast-import: remove dead strbuf Thalia Archibald
2024-04-14  1:12         ` [PATCH v5 5/8] fast-import: improve documentation for path quoting Thalia Archibald
2024-04-14  1:12         ` [PATCH v5 6/8] fast-import: document C-style escapes for paths Thalia Archibald
2024-04-14  1:12         ` [PATCH v5 7/8] fast-import: forbid escaped NUL in paths Thalia Archibald
2024-04-14  1:12         ` [PATCH v5 8/8] fast-import: make comments more precise Thalia Archibald
2024-04-15  7:06         ` [PATCH v5 0/8] fast-import: tighten parsing of paths Patrick Steinhardt
2024-04-15 17:07           ` 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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq5xwnu182.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=chris.torek@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=newren@gmail.com \
    --cc=ps@pks.im \
    --cc=thalia@archibald.dev \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).