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