summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThalia Archibald <thalia@archibald.dev>2024-04-14 01:12:12 (GMT)
committerJunio C Hamano <gitster@pobox.com>2024-04-15 17:06:18 (GMT)
commita923a04b80885368acacaf280eb0db16270e5a5b (patch)
treefbe081f616838fd087babed29c1ac94241e6f6cd
parent22915955caaff8b49671426aba31cbcee19ed0ac (diff)
downloadgit-a923a04b80885368acacaf280eb0db16270e5a5b.zip
git-a923a04b80885368acacaf280eb0db16270e5a5b.tar.gz
git-a923a04b80885368acacaf280eb0db16270e5a5b.tar.bz2
fast-import: document C-style escapes for paths
Simply saying “C-style” string quoting is imprecise, as only a subset of C escapes are supported. Document the exact escapes. Signed-off-by: Thalia Archibald <thalia@archibald.dev> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--Documentation/git-fast-import.txt6
-rwxr-xr-xt/t9300-fast-import.sh10
2 files changed, 11 insertions, 5 deletions
diff --git a/Documentation/git-fast-import.txt b/Documentation/git-fast-import.txt
index 1882758..c6082c3 100644
--- a/Documentation/git-fast-import.txt
+++ b/Documentation/git-fast-import.txt
@@ -643,7 +643,11 @@ When a `<path>` starts with a double quote (`"`), it is a C-style quoted
string, where the complete filename is enclosed in a pair of double
quotes and escape sequences are used. Certain characters must be escaped
by preceding them with a backslash: `LF` is written as `\n`, backslash
-as `\\`, and double quote as `\"`. All filenames can be represented as
+as `\\`, and double quote as `\"`. Some characters 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`). All filenames can be represented as
quoted strings.
A `<path>` must use UNIX-style directory separators (forward slash `/`)
diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
index 13f98e6..5cde8f8 100755
--- a/t/t9300-fast-import.sh
+++ b/t/t9300-fast-import.sh
@@ -3189,8 +3189,9 @@ test_path_eol_success () {
'
}
-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'
#
# Valid paths before a space: filecopy (source) and filerename (source).
@@ -3256,8 +3257,9 @@ test_path_space_success () {
'
}
-test_path_space_success 'quoted spaces' '" hello world.c "' ' hello world.c '
-test_path_space_success 'no unquoted spaces' 'hello_world.c' 'hello_world.c'
+test_path_space_success 'quoted spaces' '" hello world.c "' ' hello world.c '
+test_path_space_success 'no unquoted spaces' 'hello_world.c' 'hello_world.c'
+test_path_space_success 'octal escapes' '"\150\151\056\143"' 'hi.c'
#
# Test a single commit change with an invalid path. Run it with all occurrences