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 -S (nomatch)' '
84 git log -Spicked --format=%H >actual &&
85 >expect &&
86 test_cmp expect actual
87'
88
89test_expect_success 'log -S (match)' '
90 git log -SPicked --format=%H >actual &&
91 git rev-parse --verify HEAD >expect &&
92 test_cmp expect actual
93'
94
95test_expect_success 'log -S --regexp-ignore-case (match)' '
96 git log --regexp-ignore-case -Spicked --format=%H >actual &&
97 git rev-parse --verify HEAD >expect &&
98 test_cmp expect actual
99'
100
101test_expect_success 'log -S -i (match)' '
102 git log -i -Spicked --format=%H >actual &&
103 git rev-parse --verify HEAD >expect &&
104 test_cmp expect actual
105'
106
107test_expect_success 'log -S --regexp-ignore-case (nomatch)' '
108 git log --regexp-ignore-case -Spickle --format=%H >actual &&
109 >expect &&
110 test_cmp expect actual
111'
112
113test_expect_success 'log -S -i (nomatch)' '
114 git log -i -Spickle --format=%H >actual &&
115 >expect &&
116 test_cmp expect actual
117'
118
119test_done