bb5e7100549c77745a91105a9ce2a1a0e3f0a7e3
1#!/bin/sh
2
3test_description='test globbing (and noglob) of pathspec limiting'
4. ./test-lib.sh
5
6test_expect_success 'create commits with glob characters' '
7 test_commit unrelated bar &&
8 test_commit vanilla foo &&
9 test_commit star "f*" &&
10 test_commit bracket "f[o][o]"
11'
12
13test_expect_success 'vanilla pathspec matches literally' '
14 echo vanilla >expect &&
15 git log --format=%s -- foo >actual &&
16 test_cmp expect actual
17'
18
19test_expect_success 'star pathspec globs' '
20 cat >expect <<-\EOF &&
21 bracket
22 star
23 vanilla
24 EOF
25 git log --format=%s -- "f*" >actual &&
26 test_cmp expect actual
27'
28
29test_expect_success 'bracket pathspec globs and matches literal brackets' '
30 cat >expect <<-\EOF &&
31 bracket
32 vanilla
33 EOF
34 git log --format=%s -- "f[o][o]" >actual &&
35 test_cmp expect actual
36'
37
38test_expect_success 'no-glob option matches literally (vanilla)' '
39 echo vanilla >expect &&
40 git --literal-pathspecs log --format=%s -- foo >actual &&
41 test_cmp expect actual
42'
43
44test_expect_success 'no-glob option matches literally (star)' '
45 echo star >expect &&
46 git --literal-pathspecs log --format=%s -- "f*" >actual &&
47 test_cmp expect actual
48'
49
50test_expect_success 'no-glob option matches literally (bracket)' '
51 echo bracket >expect &&
52 git --literal-pathspecs log --format=%s -- "f[o][o]" >actual &&
53 test_cmp expect actual
54'
55
56test_expect_success 'no-glob environment variable works' '
57 echo star >expect &&
58 GIT_LITERAL_PATHSPECS=1 git log --format=%s -- "f*" >actual &&
59 test_cmp expect actual
60'
61
62test_done