1#!/bin/sh
2
3test_description='log --grep/--author/--regexp-ignore-case/-S/-G'
4. ./test-lib.sh
5
6test_expect_success setup '
7 >file &&
8 git add file &&
9 test_tick &&
10 git commit -m initial &&
11
12 echo Picked >file &&
13 test_tick &&
14 git commit -a --author="Another Person <another@example.com>" -m second
15'
16
17test_expect_success 'log --grep' '
18 git log --grep=initial --format=%H >actual &&
19 git rev-parse --verify HEAD^ >expect &&
20 test_cmp expect actual
21'
22
23test_expect_success 'log --grep --regexp-ignore-case' '
24 git log --regexp-ignore-case --grep=InItial --format=%H >actual &&
25 git rev-parse --verify HEAD^ >expect &&
26 test_cmp expect actual
27'
28
29test_expect_success 'log --grep -i' '
30 git log -i --grep=InItial --format=%H >actual &&
31 git rev-parse --verify HEAD^ >expect &&
32 test_cmp expect actual
33'
34
35test_expect_success 'log --author --regexp-ignore-case' '
36 git log --regexp-ignore-case --author=person --format=%H >actual &&
37 git rev-parse --verify HEAD >expect &&
38 test_cmp expect actual
39'
40
41test_expect_success 'log --author -i' '
42 git log -i --author=person --format=%H >actual &&
43 git rev-parse --verify HEAD >expect &&
44 test_cmp expect actual
45'
46
47test_expect_success 'log -G (nomatch)' '
48 git log -Gpicked --format=%H >actual &&
49 >expect &&
50 test_cmp expect actual
51'
52
53test_expect_success 'log -G (match)' '
54 git log -GPicked --format=%H >actual &&
55 git rev-parse --verify HEAD >expect &&
56 test_cmp expect actual
57'
58
59test_expect_success 'log -G --regexp-ignore-case (nomatch)' '
60 git log --regexp-ignore-case -Gpickle --format=%H >actual &&
61 >expect &&
62 test_cmp expect actual
63'
64
65test_expect_success 'log -G -i (nomatch)' '
66 git log -i -Gpickle --format=%H >actual &&
67 >expect &&
68 test_cmp expect actual
69'
70
71test_expect_success 'log -G --regexp-ignore-case (match)' '
72 git log --regexp-ignore-case -Gpicked --format=%H >actual &&
73 git rev-parse --verify HEAD >expect &&
74 test_cmp expect actual
75'
76
77test_expect_success 'log -G -i (match)' '
78 git log -i -Gpicked --format=%H >actual &&
79 git rev-parse --verify HEAD >expect &&
80 test_cmp expect actual
81'
82
83test_expect_success 'log -G --textconv (missing textconv tool)' '
84 echo "* diff=test" >.gitattributes &&
85 test_must_fail git -c diff.test.textconv=missing log -Gfoo &&
86 rm .gitattributes
87'
88
89test_expect_success 'log -G --no-textconv (missing textconv tool)' '
90 echo "* diff=test" >.gitattributes &&
91 git -c diff.test.textconv=missing log -Gfoo --no-textconv >actual &&
92 >expect &&
93 test_cmp expect actual &&
94 rm .gitattributes
95'
96
97test_expect_success 'log -S (nomatch)' '
98 git log -Spicked --format=%H >actual &&
99 >expect &&
100 test_cmp expect actual
101'
102
103test_expect_success 'log -S (match)' '
104 git log -SPicked --format=%H >actual &&
105 git rev-parse --verify HEAD >expect &&
106 test_cmp expect actual
107'
108
109test_expect_success 'log -S --regexp-ignore-case (match)' '
110 git log --regexp-ignore-case -Spicked --format=%H >actual &&
111 git rev-parse --verify HEAD >expect &&
112 test_cmp expect actual
113'
114
115test_expect_success 'log -S -i (match)' '
116 git log -i -Spicked --format=%H >actual &&
117 git rev-parse --verify HEAD >expect &&
118 test_cmp expect actual
119'
120
121test_expect_success 'log -S --regexp-ignore-case (nomatch)' '
122 git log --regexp-ignore-case -Spickle --format=%H >actual &&
123 >expect &&
124 test_cmp expect actual
125'
126
127test_expect_success 'log -S -i (nomatch)' '
128 git log -i -Spickle --format=%H >actual &&
129 >expect &&
130 test_cmp expect actual
131'
132
133test_expect_success 'log -S --textconv (missing textconv tool)' '
134 echo "* diff=test" >.gitattributes &&
135 test_must_fail git -c diff.test.textconv=missing log -Sfoo &&
136 rm .gitattributes
137'
138
139test_expect_success 'log -S --no-textconv (missing textconv tool)' '
140 echo "* diff=test" >.gitattributes &&
141 git -c diff.test.textconv=missing log -Sfoo --no-textconv >actual &&
142 >expect &&
143 test_cmp expect actual &&
144 rm .gitattributes
145'
146
147test_done