33test_description=' log --grep/--author/--regexp-ignore-case/-S/-G'
44. ./test-lib.sh
55
6+ test_log () {
7+ expect=$1
8+ kind=$2
9+ needle=$3
10+ shift 3
11+ rest=$@
12+
13+ case $kind in
14+ --* )
15+ opt=$kind =$needle
16+ ;;
17+ * )
18+ opt=$kind$needle
19+ ;;
20+ esac
21+ case $expect in
22+ expect_nomatch)
23+ match=nomatch
24+ ;;
25+ * )
26+ match=match
27+ ;;
28+ esac
29+
30+ test_expect_success " log $kind ${rest: + $rest } ($match )" "
31+ git log $rest $opt --format=%H >actual &&
32+ test_cmp $expect actual
33+ "
34+ }
35+
636test_expect_success setup '
737 >expect_nomatch &&
838
@@ -44,35 +74,12 @@ test_expect_success 'log --author -i' '
4474 test_cmp expect_second actual
4575'
4676
47- test_expect_success ' log -G (nomatch)' '
48- git log -Gpicked --format=%H >actual &&
49- test_cmp expect_nomatch actual
50- '
51-
52- test_expect_success ' log -G (match)' '
53- git log -GPicked --format=%H >actual &&
54- test_cmp expect_second actual
55- '
56-
57- test_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-
62- test_expect_success ' log -G -i (nomatch)' '
63- git log -i -Gpickle --format=%H >actual &&
64- test_cmp expect_nomatch actual
65- '
66-
67- test_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-
72- test_expect_success ' log -G -i (match)' '
73- git log -i -Gpicked --format=%H >actual &&
74- test_cmp expect_second actual
75- '
77+ test_log expect_nomatch -G picked
78+ test_log expect_second -G Picked
79+ test_log expect_nomatch -G pickle --regexp-ignore-case
80+ test_log expect_nomatch -G pickle -i
81+ test_log expect_second -G picked --regexp-ignore-case
82+ test_log expect_second -G picked -i
7683
7784test_expect_success ' log -G --textconv (missing textconv tool)' '
7885 echo "* diff=test" >.gitattributes &&
@@ -87,35 +94,12 @@ test_expect_success 'log -G --no-textconv (missing textconv tool)' '
8794 rm .gitattributes
8895'
8996
90- test_expect_success ' log -S (nomatch)' '
91- git log -Spicked --format=%H >actual &&
92- test_cmp expect_nomatch actual
93- '
94-
95- test_expect_success ' log -S (match)' '
96- git log -SPicked --format=%H >actual &&
97- test_cmp expect_second actual
98- '
99-
100- test_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-
105- test_expect_success ' log -S -i (match)' '
106- git log -i -Spicked --format=%H >actual &&
107- test_cmp expect_second actual
108- '
109-
110- test_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-
115- test_expect_success ' log -S -i (nomatch)' '
116- git log -i -Spickle --format=%H >actual &&
117- test_cmp expect_nomatch actual
118- '
97+ test_log expect_nomatch -S picked
98+ test_log expect_second -S Picked
99+ test_log expect_second -S picked --regexp-ignore-case
100+ test_log expect_second -S picked -i
101+ test_log expect_nomatch -S pickle --regexp-ignore-case
102+ test_log expect_nomatch -S pickle -i
119103
120104test_expect_success ' log -S --textconv (missing textconv tool)' '
121105 echo "* diff=test" >.gitattributes &&
0 commit comments