3 test_description='check that read-tree rejects confusing paths'
6 test_expect_success 'create base tree' '
10 blob=$(git rev-parse HEAD:file) &&
11 tree=$(git rev-parse HEAD^{tree})
14 test_expect_success 'enable core.protectHFS for rejection tests' '
15 git config core.protectHFS true
18 test_expect_success 'enable core.protectNTFS for rejection tests' '
19 git config core.protectNTFS true
22 while read path pretty; do
29 test_expect_success "reject $pretty at end of path" '
30 printf "100644 blob %s\t%s" "$blob" "$path" >tree &&
31 bogus=$(git mktree <tree) &&
32 test_must_fail git read-tree $bogus
35 test_expect_success "reject $pretty as subtree" '
36 printf "040000 tree %s\t%s" "$tree" "$path" >tree &&
37 bogus=$(git mktree <tree) &&
38 test_must_fail git read-tree $bogus
45 ${u200c}.Git {u200c}.Git
46 .gI${u200c}T .gI{u200c}T
47 .GiT${u200c} .GiT{u200c}
49 .git.SPACE .git.{space}
50 .\\\\.GIT\\\\foobar backslashes
51 .git\\\\foobar backslashes2
52 .git...:alternate-stream
55 test_expect_success 'utf-8 paths allowed with core.protectHFS off' '
56 test_when_finished "git read-tree HEAD" &&
57 test_config core.protectHFS false &&
58 printf "100644 blob %s\t%s" "$blob" ".gi${u200c}t" >tree &&
59 ok=$(git mktree <tree) &&