From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [IPv6:2604:1380:40f1:3f00::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 3196C1F44D for ; Wed, 10 Apr 2024 09:56:35 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (2048-bit key; unprotected) header.d=archibald.dev header.i=@archibald.dev header.a=rsa-sha256 header.s=protonmail3 header.b=tibs8qwf; dkim-atps=neutral Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id E3D13B21DD4 for ; Wed, 10 Apr 2024 09:56:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1DAEF1586CD; Wed, 10 Apr 2024 09:56:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=archibald.dev header.i=@archibald.dev header.b="tibs8qwf" Received: from mail-4323.proton.ch (mail-4323.proton.ch [185.70.43.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 214E11552F7 for ; Wed, 10 Apr 2024 09:56:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.70.43.23 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712742970; cv=none; b=LtXxNsuNKybjJHzyi8MdTQsfQpNUcIkHj8naSv9ekWnkh1GKX1n37GfTa482TXFzzAl/Sp/Un5BrqrgSjYjzX9llaDTH8iv2vyMP27Vsth5KCDa/Lfzb2or9Awir2lHdRF0u7yd5SA34ymGKsn4tLSl9JaKYWCpJGGA9xtZpEuA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712742970; c=relaxed/simple; bh=WPzqEvQpU4C2O5x6yCuxGCvax9aBUfOqE3w3ExSwJHg=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=GTcqjXg3ZILGrm4fZ/t+ZZ6mQLZIPvkOF1RHMFvSKxwCMg03NKe8PXGpHWL2/QmeW94ey8Qxt2fgxlXwQl0b5vichpcmRU4Du9N+fmjp48Rcp2j5eLEfPFdmZoD1YcRZ+7TRKy5fRc7KOXTCj6a1qtpIf0oTUjLab52wt6+m/fk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=archibald.dev; spf=pass smtp.mailfrom=archibald.dev; dkim=pass (2048-bit key) header.d=archibald.dev header.i=@archibald.dev header.b=tibs8qwf; arc=none smtp.client-ip=185.70.43.23 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=archibald.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=archibald.dev DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=archibald.dev; s=protonmail3; t=1712742967; x=1713002167; bh=N8XgjHlZHmADcp4IaJMk7NLtAcvIzKo5zzwBmK4XP6I=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=tibs8qwfevFP+Pl0WpiZIkiNF8JqVza9pVAnBc/rNemQc6clzXCav+WJkXEqeQ3SK IqqgVIjlToUj39auTMps9NIciNs1+bJPKzTiBz1oys3Big6RBsmDoKZONbaQvuYunq biL42W80hK3bVfH7pwHbZ8jk9LjVXpWJ3hfqH5glpXGdPQ26gxJqcPqrL1ImzrPpFq 9c41Cf5bLtCqbklFsbUJzSKx8x27NsnjFWVlapfgXfonP5N/MUGbB2w7ajYnZEVsr3 /7q2rc6W4Q4reJHVPnWzZYR6Afh+L1PsYViCAK4Kwc9LyGEyE/q9q3QEnpVMfA08/W 2pJmljtBjHAAg== Date: Wed, 10 Apr 2024 09:55:56 +0000 To: git@vger.kernel.org From: Thalia Archibald Cc: Patrick Steinhardt , Chris Torek , Elijah Newren , Thalia Archibald Subject: [PATCH v3 5/8] fast-import: improve documentation for unquoted paths Message-ID: <2e78690023f653436ec2eba0c5fb9dfa6bb62624.1712741871.git.thalia@archibald.dev> In-Reply-To: References: <20240322000304.76810-1-thalia@archibald.dev> Feedback-ID: 63908566:user:proton Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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 restriction that the source paths of filecopy and filerename cannot contain SP is only stated in their respective sections. Restate it in the section. Signed-off-by: Thalia Archibald --- 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-imp= ort.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 `` is the complete path of the file to be added (if not already existing) or modified (if already existing). =20 -A `` string must use UNIX-style directory separators (forward -slash `/`), may contain any byte other than `LF`, and must not -start with double quote (`"`). +A `` can be written as unquoted bytes or a C-style quoted string: =20 -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 +When a `` 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 +`` in `filecopy` or `filerename` must be quoted if it contains SP. + +A `` 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 surrou= nded with 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"`). =20 -The value of `` must be in canonical form. That is it must not: +A `` must use UNIX-style directory separators (forward slash `/`) +and must be in canonical form. That is it must not: =20 * contain an empty directory component (e.g. `foo//bar` is invalid), * end with a directory separator (e.g. `foo/` is invalid), --=20 2.44.0