Skip to content

Commit a923a04

Browse files
thaliaarchigitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2291595 commit a923a04

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

Documentation/git-fast-import.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,11 @@ When a `<path>` starts with a double quote (`"`), it is a C-style quoted
643643
string, where the complete filename is enclosed in a pair of double
644644
quotes and escape sequences are used. Certain characters must be escaped
645645
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
647651
quoted strings.
648652

649653
A `<path>` must use UNIX-style directory separators (forward slash `/`)

t/t9300-fast-import.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3189,8 +3189,9 @@ test_path_eol_success () {
31893189
'
31903190
}
31913191

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'
31943195

31953196
#
31963197
# Valid paths before a space: filecopy (source) and filerename (source).
@@ -3256,8 +3257,9 @@ test_path_space_success () {
32563257
'
32573258
}
32583259

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'
32613263

32623264
#
32633265
# Test a single commit change with an invalid path. Run it with all occurrences

0 commit comments

Comments
 (0)