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: AS54825 147.75.192.0/21 X-Spam-Status: No, score=-4.2 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 5F9F01F44D for ; Wed, 10 Apr 2024 09:56:39 +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=w2hfW1iJ; 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 9B1061C20ADB for ; Wed, 10 Apr 2024 09:56:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 13D81158D6E; Wed, 10 Apr 2024 09:56:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=archibald.dev header.i=@archibald.dev header.b="w2hfW1iJ" 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 BA14815887C for ; Wed, 10 Apr 2024 09:56:15 +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=1712742978; cv=none; b=hnj6MmYBATymY2bqWWMlDv3G3s6scwEZwmwQd5nerONITE+Cd/7fl5fX9AH2M+maIOExe+ThrR9Lj/nPoPGBxsDN5SR04vEcM40DNjrpPLe6ycgvE2zbbx1gtjzqzpBZvJrBmukPWAJNloOaDTotwB04RwOQbZhcnByZhIp9jxk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712742978; c=relaxed/simple; bh=EgvxaSGNxzcUf/rlDo9IUXkuHnwoD8YDauyzr9h9Vcc=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Wymtz5pV4B03MXSlv/PsO8sB6VhFIN+fV+WoziSDibQ0KpE1mQZ5yGFajPMluVctBk8okO+RnW3+d6r/8XMGaLT/v+Mf6xb9NxUA4YY2khYm40dnBubytgmSDo29ec1QsOZAN/VvkcMMtaohgX0oDw4HF3ubcxMy/Jnpbc086ZM= 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=w2hfW1iJ; 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=1712742973; x=1713002173; bh=Nm/LiCCcd/ychPRVchBFnGMgvuHX8P8JBDTMJzk4bBc=; 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=w2hfW1iJ6U4L+lKZBjQMRPIsfDP8pUwz8REIgOIOG217mz2lvgM3/vERMk1zq09xu fMhupWMGsApWEGxu3rkRJkr6ypzWyk7LTVAq+YcDKvtCyiI/u0RVd5OpoaplmHsHK6 C3Ga6eDMGBEP12G3uqxA6Mg66V8/+cvAcWWLgIOsY+XV8vTGE8j1csqnKfsZBoPrYy vIutk4brLD8anVrug54JoLq5caAfm0d75aBylK59j/RyZtQx07WGzSooOGdR3BHuyh SkJzp1fU8ku3k1UXWnjjJwirF2MfnjxxWIqMpxSa7Pqndev7ZBAKEF6qoSPzFAmpJK bhrsHXhv7nX4Q== Date: Wed, 10 Apr 2024 09:56:03 +0000 To: git@vger.kernel.org From: Thalia Archibald Cc: Patrick Steinhardt , Chris Torek , Elijah Newren , Thalia Archibald Subject: [PATCH v3 6/8] fast-import: document C-style escapes for paths Message-ID: <1b07ddffe000ed2ab34bd41f4f0558ae8b2dd663.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 Simply saying =E2=80=9CC-style=E2=80=9D string quoting is imprecise, as onl= y a subset of C escapes are supported. Document the exact escapes. Signed-off-by: Thalia Archibald --- Documentation/git-fast-import.txt | 12 ++++++++---- t/t9300-fast-import.sh | 10 ++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Documentation/git-fast-import.txt b/Documentation/git-fast-imp= ort.txt index f26d7a8571..db53b50268 100644 --- a/Documentation/git-fast-import.txt +++ b/Documentation/git-fast-import.txt @@ -640,10 +640,14 @@ quote, it must be written as a quoted string. Additio= nally, the source =20 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"`). +an unquoted string. In C-style quoting, the complete filename is +surrounded with double quote (`"`) and certain characters must be +escaped by preceding them with a backslash: `LF` is written as `\n`, +backslash as `\\`, and double quote as `\"`. Some characters may may +optionally be written with escape sequences: `\a` for bell, `\b` for +backspace, `\f` for form feed, `\n` for line feed, `\r` for carriage +return, `\t` for horizontal tab, and `\v` for vertical tab. Any byte can +be written with 3-digit octal codes (e.g., `\033`). =20 A `` must use UNIX-style directory separators (forward slash `/`) and must be in canonical form. That is it must not: diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh index 13f98e6688..5cde8f8d01 100755 --- a/t/t9300-fast-import.sh +++ b/t/t9300-fast-import.sh @@ -3189,8 +3189,9 @@ test_path_eol_success () { =09' } =20 -test_path_eol_success 'quoted spaces' '" hello world.c "' ' hello world.= c ' -test_path_eol_success 'unquoted spaces' ' hello world.c ' ' hello world.= c ' +test_path_eol_success 'quoted spaces' '" hello world.c "' ' hello world= .c ' +test_path_eol_success 'unquoted spaces' ' hello world.c ' ' hello world= .c ' +test_path_eol_success 'octal escapes' '"\150\151\056\143"' 'hi.c' =20 # # Valid paths before a space: filecopy (source) and filerename (source). @@ -3256,8 +3257,9 @@ test_path_space_success () { =09' } =20 -test_path_space_success 'quoted spaces' '" hello world.c "' ' hello w= orld.c ' -test_path_space_success 'no unquoted spaces' 'hello_world.c' 'hello_wo= rld.c' +test_path_space_success 'quoted spaces' '" hello world.c "' ' hello = world.c ' +test_path_space_success 'no unquoted spaces' 'hello_world.c' 'hello_w= orld.c' +test_path_space_success 'octal escapes' '"\150\151\056\143"' 'hi.c' =20 # # Test a single commit change with an invalid path. Run it with all occurr= ences --=20 2.44.0