3 test_description
='check that read-tree rejects confusing paths'
5 TEST_PASSES_SANITIZE_LEAK
=true
8 test_expect_success
'create base tree' '
12 blob=$(git rev-parse HEAD:file) &&
13 tree=$(git rev-parse HEAD^{tree})
16 test_expect_success
'enable core.protectHFS for rejection tests' '
17 git config core.protectHFS true
20 test_expect_success
'enable core.protectNTFS for rejection tests' '
21 git config core.protectNTFS true
24 while read path pretty
; do
31 test_expect_success
"reject $pretty at end of path" '
32 printf "100644 blob %s\t%s" "$blob" "$path" >tree &&
33 bogus=$(git mktree <tree) &&
34 test_must_fail git read-tree $bogus
37 test_expect_success
"reject $pretty as subtree" '
38 printf "040000 tree %s\t%s" "$tree" "$path" >tree &&
39 bogus=$(git mktree <tree) &&
40 test_must_fail git read-tree $bogus
47 ${u200c}.Git {u200c}.Git
48 .gI${u200c}T .gI{u200c}T
49 .GiT${u200c} .GiT{u200c}
51 .git.SPACE .git.{space}
52 .\\\\.GIT\\\\foobar backslashes
53 .git\\\\foobar backslashes2
54 .git...:alternate-stream
57 test_expect_success
'utf-8 paths allowed with core.protectHFS off' '
58 test_when_finished "git read-tree HEAD" &&
59 test_config core.protectHFS false &&
60 printf "100644 blob %s\t%s" "$blob" ".gi${u200c}t" >tree &&
61 ok=$(git mktree <tree) &&