Skip to content

Commit 07a176c

Browse files
ilya-bobyrgitster
authored andcommitted
diff: test: Use --patch-{grep,modifies} over -G/-S
Long argument names are easier to read, compared to short ones. So while short arguments are great when you want to type a command quickly, tests are more readable if we use long argument names. There are still test that verify that both short and long arguments work interchangeably when parsing the arguments. Tests where the focus is not on the argument names are updated to use long argument names. Signed-off-by: Junio C Hamano <[email protected]>
1 parent 16d9c40 commit 07a176c

File tree

2 files changed

+35
-35
lines changed

2 files changed

+35
-35
lines changed

t/t4062-diff-pickaxe.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ test_expect_success setup '
1616
'
1717

1818
# OpenBSD only supports up to 255 repetitions, so repeat twice for 64*64=4096.
19-
test_expect_success '-G matches' '
20-
git diff --name-only -G "^(0{64}){64}$" HEAD^ >out &&
19+
test_expect_success '--patch-grep matches' '
20+
git diff --name-only --patch-grep "^(0{64}){64}$" HEAD^ >out &&
2121
test 4096-zeroes.txt = "$(cat out)"
2222
'
2323

24-
test_expect_success '-S --pickaxe-regex' '
25-
git diff --name-only -S0 --pickaxe-regex HEAD^ >out &&
24+
test_expect_success '--patch-modifies --pickaxe-regex' '
25+
git diff --name-only --patch-modifies 0 --pickaxe-regex HEAD^ >out &&
2626
test 4096-zeroes.txt = "$(cat out)"
2727
'
2828

t/t4209-log-pickaxe.sh

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22

3-
test_description='log --grep/--author/--regexp-ignore-case/-S/-G'
3+
test_description='log --grep/--author/--regexp-ignore-case/--patch-{modifies,grep}'
44

55
. ./test-lib.sh
66

@@ -142,15 +142,15 @@ test_log_icase expect_nomatch --patch-grep pickle
142142
test_log_icase expect_second -G picked
143143
test_log_icase expect_second --patch-grep picked
144144

145-
test_expect_success 'log -G --textconv (missing textconv tool)' '
145+
test_expect_success 'log --patch-grep --textconv (missing textconv tool)' '
146146
echo "* diff=test" >.gitattributes &&
147-
test_must_fail git -c diff.test.textconv=missing log -Gfoo &&
147+
test_must_fail git -c diff.test.textconv=missing log --patch-grep foo &&
148148
rm .gitattributes
149149
'
150150

151-
test_expect_success 'log -G --no-textconv (missing textconv tool)' '
151+
test_expect_success 'log --patch-grep --no-textconv (missing textconv tool)' '
152152
echo "* diff=test" >.gitattributes &&
153-
git -c diff.test.textconv=missing log -Gfoo --no-textconv >actual &&
153+
git -c diff.test.textconv=missing log --patch-grep foo --no-textconv >actual &&
154154
test_cmp expect_nomatch actual &&
155155
rm .gitattributes
156156
'
@@ -173,20 +173,20 @@ test_log_icase expect_second --patch-modifies p.cked --pickaxe-regex
173173
test_log_icase expect_nomatch -S p.ckle --pickaxe-regex
174174
test_log_icase expect_nomatch --patch-modifies p.ckle --pickaxe-regex
175175

176-
test_expect_success 'log -S --textconv (missing textconv tool)' '
176+
test_expect_success 'log --patch-modifies --textconv (missing textconv tool)' '
177177
echo "* diff=test" >.gitattributes &&
178-
test_must_fail git -c diff.test.textconv=missing log -Sfoo &&
178+
test_must_fail git -c diff.test.textconv=missing log --patch-modifies foo &&
179179
rm .gitattributes
180180
'
181181

182-
test_expect_success 'log -S --no-textconv (missing textconv tool)' '
182+
test_expect_success 'log --patch-modifies --no-textconv (missing textconv tool)' '
183183
echo "* diff=test" >.gitattributes &&
184-
git -c diff.test.textconv=missing log -Sfoo --no-textconv >actual &&
184+
git -c diff.test.textconv=missing log --patch-modifies foo --no-textconv >actual &&
185185
test_cmp expect_nomatch actual &&
186186
rm .gitattributes
187187
'
188188

189-
test_expect_success 'setup log -[GS] plain & regex' '
189+
test_expect_success 'setup log --patch{-modifies,-grep} plain & regex' '
190190
test_create_repo GS-plain &&
191191
test_commit -C GS-plain --append A data.txt "a" &&
192192
test_commit -C GS-plain --append B data.txt "a a" &&
@@ -201,68 +201,68 @@ test_expect_success 'setup log -[GS] plain & regex' '
201201
git -C GS-plain log >full-log
202202
'
203203

204-
test_expect_success 'log -G trims diff new/old [-+]' '
205-
git -C GS-plain log -G"[+-]a" >log &&
204+
test_expect_success 'log --patch-grep trims diff new/old [-+]' '
205+
git -C GS-plain log --patch-grep "[+-]a" >log &&
206206
test_must_be_empty log &&
207-
git -C GS-plain log -G"^a" >log &&
207+
git -C GS-plain log --patch-grep "^a" >log &&
208208
test_cmp log A-to-B-then-E-log
209209
'
210210

211-
test_expect_success 'log -S<pat> is not a regex, but -S<pat> --pickaxe-regex is' '
212-
git -C GS-plain log -S"a" >log &&
211+
test_expect_success 'log --patch-modifies <pat> is not a regex, but --patch-modifies <pat> --pickaxe-regex is' '
212+
git -C GS-plain log --patch-modifies "a" >log &&
213213
test_cmp log A-to-B-then-E-log &&
214214
215-
git -C GS-plain log -S"[a]" >log &&
215+
git -C GS-plain log --patch-modifies "[a]" >log &&
216216
test_must_be_empty log &&
217217
218-
git -C GS-plain log -S"[a]" --pickaxe-regex >log &&
218+
git -C GS-plain log --patch-modifies "[a]" --pickaxe-regex >log &&
219219
test_cmp log A-to-B-then-E-log &&
220220
221-
git -C GS-plain log -S"[b]" >log &&
221+
git -C GS-plain log --patch-modifies "[b]" >log &&
222222
test_cmp log D-then-E-log &&
223223
224-
git -C GS-plain log -S"[b]" --pickaxe-regex >log &&
224+
git -C GS-plain log --patch-modifies "[b]" --pickaxe-regex >log &&
225225
test_cmp log C-to-D-then-E-log
226226
'
227227

228-
test_expect_success 'setup log -[GS] binary & --text' '
228+
test_expect_success 'setup log --patch{-modifies,-grep} binary & --text' '
229229
test_create_repo GS-bin-txt &&
230230
test_commit -C GS-bin-txt --printf A data.bin "a\na\0a\n" &&
231231
test_commit -C GS-bin-txt --append --printf B data.bin "a\na\0a\n" &&
232232
test_commit -C GS-bin-txt C data.bin "" &&
233233
git -C GS-bin-txt log >full-log
234234
'
235235

236-
test_expect_success 'log -G ignores binary files' '
237-
git -C GS-bin-txt log -Ga >log &&
236+
test_expect_success 'log --patch-grep ignores binary files' '
237+
git -C GS-bin-txt log --patch-grep a >log &&
238238
test_must_be_empty log
239239
'
240240

241-
test_expect_success 'log -G looks into binary files with -a' '
242-
git -C GS-bin-txt log -a -Ga >log &&
241+
test_expect_success 'log --patch-grep looks into binary files with -a' '
242+
git -C GS-bin-txt log -a --patch-grep a >log &&
243243
test_cmp log full-log
244244
'
245245

246-
test_expect_success 'log -G looks into binary files with textconv filter' '
246+
test_expect_success 'log --patch-grep looks into binary files with textconv filter' '
247247
test_when_finished "rm GS-bin-txt/.gitattributes" &&
248248
(
249249
cd GS-bin-txt &&
250250
echo "* diff=bin" >.gitattributes &&
251-
git -c diff.bin.textconv=cat log -Ga >../log
251+
git -c diff.bin.textconv=cat log --patch-grep a >../log
252252
) &&
253253
test_cmp log full-log
254254
'
255255

256-
test_expect_success 'log -S looks into binary files' '
257-
git -C GS-bin-txt log -Sa >log &&
256+
test_expect_success 'log --patch-modifies looks into binary files' '
257+
git -C GS-bin-txt log --patch-modifies a >log &&
258258
test_cmp log full-log
259259
'
260260

261-
test_expect_success 'log -S --pickaxe-regex looks into binary files' '
262-
git -C GS-bin-txt log --pickaxe-regex -Sa >log &&
261+
test_expect_success 'log --patch-modifies --pickaxe-regex looks into binary files' '
262+
git -C GS-bin-txt log --pickaxe-regex --patch-modifies a >log &&
263263
test_cmp log full-log &&
264264
265-
git -C GS-bin-txt log --pickaxe-regex -S"[a]" >log &&
265+
git -C GS-bin-txt log --pickaxe-regex --patch-modifies "[a]" >log &&
266266
test_cmp log full-log
267267
'
268268

0 commit comments

Comments
 (0)