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>

Thalia Archibald committed Apr 14, 2024 at 01:12 UTC a923a04b80885368acacaf280eb0db16270e5a5b
2 files changed +11 -5
Documentation/git-fast-import.txt
+5 -1
@@ -643,7 +643,11 @@ When a `<path>` starts with a double quote (`"`), it is a C-style quoted
643 string, where the complete filename is enclosed in a pair of double
644 quotes and escape sequences are used. Certain characters must be escaped
645 by preceding them with a backslash: `LF` is written as `\n`, backslash
646 -as `\\`, and double quote as `\"`. All filenames can be represented as
646 +as `\\`, and double quote as `\"`. Some characters may optionally be
647 +written with escape sequences: `\a` for bell, `\b` for backspace, `\f`
648 +for form feed, `\n` for line feed, `\r` for carriage return, `\t` for
649 +horizontal tab, and `\v` for vertical tab. Any byte can be written with
650 +3-digit octal codes (e.g., `\033`). All filenames can be represented as
651 quoted strings.
652
653 A `<path>` must use UNIX-style directory separators (forward slash `/`)
t/t9300-fast-import.sh
+6 -4
@@ -3189,8 +3189,9 @@ test_path_eol_success () {
3189 '
3190 }
3191
3192 -test_path_eol_success 'quoted spaces' '" hello world.c "' ' hello world.c '
3193 -test_path_eol_success 'unquoted spaces' ' hello world.c ' ' hello world.c '
3192 +test_path_eol_success 'quoted spaces' '" hello world.c "' ' hello world.c '
3193 +test_path_eol_success 'unquoted spaces' ' hello world.c ' ' hello world.c '
3194 +test_path_eol_success 'octal escapes' '"\150\151\056\143"' 'hi.c'
3195
3196 #
3197 # Valid paths before a space: filecopy (source) and filerename (source).
@@ -3256,8 +3257,9 @@ test_path_space_success () {
3257 '
3258 }
3259
3259 -test_path_space_success 'quoted spaces' '" hello world.c "' ' hello world.c '
3260 -test_path_space_success 'no unquoted spaces' 'hello_world.c' 'hello_world.c'
3260 +test_path_space_success 'quoted spaces' '" hello world.c "' ' hello world.c '
3261 +test_path_space_success 'no unquoted spaces' 'hello_world.c' 'hello_world.c'
3262 +test_path_space_success 'octal escapes' '"\150\151\056\143"' 'hi.c'
3263
3264 #
3265 # Test a single commit change with an invalid path. Run it with all occurrences