Revert "compat: add strtok_r()"
[git/mingw.git] / t / t6130-pathspec-noglob.sh
blob39ef61994f6a4b4bea1731002f7637232e7dd349
1 #!/bin/sh
3 test_description='test globbing (and noglob) of pathspec limiting'
4 . ./test-lib.sh
6 test_expect_success 'create commits with glob characters' '
7 test_commit unrelated bar &&
8 test_commit vanilla foo &&
9 # insert file "f*" in the commit, but in a way that avoids
10 # the name "f*" in the worktree, because it is not allowed
11 # on Windows (the tests below do not depend on the presence
12 # of the file in the worktree)
13 git update-index --add --cacheinfo 100644 "$(git rev-parse HEAD:foo)" "f*" &&
14 test_tick &&
15 git commit -m star &&
16 test_commit bracket "f[o][o]"
19 test_expect_success 'vanilla pathspec matches literally' '
20 echo vanilla >expect &&
21 git log --format=%s -- foo >actual &&
22 test_cmp expect actual
25 test_expect_success 'star pathspec globs' '
26 cat >expect <<-\EOF &&
27 bracket
28 star
29 vanilla
30 EOF
31 git log --format=%s -- "f*" >actual &&
32 test_cmp expect actual
35 test_expect_success 'bracket pathspec globs and matches literal brackets' '
36 cat >expect <<-\EOF &&
37 bracket
38 vanilla
39 EOF
40 git log --format=%s -- "f[o][o]" >actual &&
41 test_cmp expect actual
44 test_expect_success 'no-glob option matches literally (vanilla)' '
45 echo vanilla >expect &&
46 git --literal-pathspecs log --format=%s -- foo >actual &&
47 test_cmp expect actual
50 test_expect_success 'no-glob option matches literally (star)' '
51 echo star >expect &&
52 git --literal-pathspecs log --format=%s -- "f*" >actual &&
53 test_cmp expect actual
56 test_expect_success 'no-glob option matches literally (bracket)' '
57 echo bracket >expect &&
58 git --literal-pathspecs log --format=%s -- "f[o][o]" >actual &&
59 test_cmp expect actual
62 test_expect_success 'no-glob environment variable works' '
63 echo star >expect &&
64 GIT_LITERAL_PATHSPECS=1 git log --format=%s -- "f*" >actual &&
65 test_cmp expect actual
68 test_done