mirror of
https://github.com/git/git
synced 2024-11-05 18:59:29 +00:00
98300c8157
Mark some tests that match "*read-tree*" as passing when git is compiled with SANITIZE=leak. They'll now be listed as running under the "GIT_TEST_PASSING_SANITIZE_LEAK=true" test mode (the "linux-leaks" CI target). We still have around half the tests that match "*read-tree*" failing, but let's whitelist those that don't. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
65 lines
1.4 KiB
Bash
Executable file
65 lines
1.4 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
test_description='check that read-tree rejects confusing paths'
|
|
|
|
TEST_PASSES_SANITIZE_LEAK=true
|
|
. ./test-lib.sh
|
|
|
|
test_expect_success 'create base tree' '
|
|
echo content >file &&
|
|
git add file &&
|
|
git commit -m base &&
|
|
blob=$(git rev-parse HEAD:file) &&
|
|
tree=$(git rev-parse HEAD^{tree})
|
|
'
|
|
|
|
test_expect_success 'enable core.protectHFS for rejection tests' '
|
|
git config core.protectHFS true
|
|
'
|
|
|
|
test_expect_success 'enable core.protectNTFS for rejection tests' '
|
|
git config core.protectNTFS true
|
|
'
|
|
|
|
while read path pretty; do
|
|
: ${pretty:=$path}
|
|
case "$path" in
|
|
*SPACE)
|
|
path="${path%SPACE} "
|
|
;;
|
|
esac
|
|
test_expect_success "reject $pretty at end of path" '
|
|
printf "100644 blob %s\t%s" "$blob" "$path" >tree &&
|
|
bogus=$(git mktree <tree) &&
|
|
test_must_fail git read-tree $bogus
|
|
'
|
|
|
|
test_expect_success "reject $pretty as subtree" '
|
|
printf "040000 tree %s\t%s" "$tree" "$path" >tree &&
|
|
bogus=$(git mktree <tree) &&
|
|
test_must_fail git read-tree $bogus
|
|
'
|
|
done <<-EOF
|
|
.
|
|
..
|
|
.git
|
|
.GIT
|
|
${u200c}.Git {u200c}.Git
|
|
.gI${u200c}T .gI{u200c}T
|
|
.GiT${u200c} .GiT{u200c}
|
|
git~1
|
|
.git.SPACE .git.{space}
|
|
.\\\\.GIT\\\\foobar backslashes
|
|
.git\\\\foobar backslashes2
|
|
.git...:alternate-stream
|
|
EOF
|
|
|
|
test_expect_success 'utf-8 paths allowed with core.protectHFS off' '
|
|
test_when_finished "git read-tree HEAD" &&
|
|
test_config core.protectHFS false &&
|
|
printf "100644 blob %s\t%s" "$blob" ".gi${u200c}t" >tree &&
|
|
ok=$(git mktree <tree) &&
|
|
git read-tree $ok
|
|
'
|
|
|
|
test_done
|