mirror of
https://github.com/git/git.git
synced 2024-11-01 14:57:52 +01:00
6af95e8cbe
Windows disallows file names that contain a star. Arrange the test setup to insert the file name "f*" in the repository without the corresponding file in the worktree. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
68 lines
1.8 KiB
Bash
Executable file
68 lines
1.8 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
test_description='test globbing (and noglob) of pathspec limiting'
|
|
. ./test-lib.sh
|
|
|
|
test_expect_success 'create commits with glob characters' '
|
|
test_commit unrelated bar &&
|
|
test_commit vanilla foo &&
|
|
# insert file "f*" in the commit, but in a way that avoids
|
|
# the name "f*" in the worktree, because it is not allowed
|
|
# on Windows (the tests below do not depend on the presence
|
|
# of the file in the worktree)
|
|
git update-index --add --cacheinfo 100644 "$(git rev-parse HEAD:foo)" "f*" &&
|
|
test_tick &&
|
|
git commit -m star &&
|
|
test_commit bracket "f[o][o]"
|
|
'
|
|
|
|
test_expect_success 'vanilla pathspec matches literally' '
|
|
echo vanilla >expect &&
|
|
git log --format=%s -- foo >actual &&
|
|
test_cmp expect actual
|
|
'
|
|
|
|
test_expect_success 'star pathspec globs' '
|
|
cat >expect <<-\EOF &&
|
|
bracket
|
|
star
|
|
vanilla
|
|
EOF
|
|
git log --format=%s -- "f*" >actual &&
|
|
test_cmp expect actual
|
|
'
|
|
|
|
test_expect_success 'bracket pathspec globs and matches literal brackets' '
|
|
cat >expect <<-\EOF &&
|
|
bracket
|
|
vanilla
|
|
EOF
|
|
git log --format=%s -- "f[o][o]" >actual &&
|
|
test_cmp expect actual
|
|
'
|
|
|
|
test_expect_success 'no-glob option matches literally (vanilla)' '
|
|
echo vanilla >expect &&
|
|
git --literal-pathspecs log --format=%s -- foo >actual &&
|
|
test_cmp expect actual
|
|
'
|
|
|
|
test_expect_success 'no-glob option matches literally (star)' '
|
|
echo star >expect &&
|
|
git --literal-pathspecs log --format=%s -- "f*" >actual &&
|
|
test_cmp expect actual
|
|
'
|
|
|
|
test_expect_success 'no-glob option matches literally (bracket)' '
|
|
echo bracket >expect &&
|
|
git --literal-pathspecs log --format=%s -- "f[o][o]" >actual &&
|
|
test_cmp expect actual
|
|
'
|
|
|
|
test_expect_success 'no-glob environment variable works' '
|
|
echo star >expect &&
|
|
GIT_LITERAL_PATHSPECS=1 git log --format=%s -- "f*" >actual &&
|
|
test_cmp expect actual
|
|
'
|
|
|
|
test_done
|