tests: use 'test_must_be_empty' instead of 'test_cmp <empty> <out>'

Using 'test_must_be_empty' is shorter and more idiomatic than >empty && test_cmp empty out as it saves the creation of an empty file. Furthermore, sometimes the expected empty file doesn't have such a descriptive name like 'empty', and its creation is far away from the place where it's finally used for comparison (e.g. in 't7600-merge.sh', where two expected empty files are created in the 'setup' test, but are used only about 500 lines later). These cases were found by instrumenting 'test_cmp' to error out the test script when it's used to compare empty files, and then converted manually. Note that even after this patch there still remain a lot of cases where we use 'test_cmp' to check empty files: - Sometimes the expected output is not hard-coded in the test, but 'test_cmp' is used to ensure that two similar git commands produce the same output, and that output happens to be empty, e.g. the test 'submodule update --merge - ignores --merge for new submodules' in 't7406-submodule-update.sh'. - Repetitive common tasks, including preparing the expected results and running 'test_cmp', are often extracted into a helper function, and some of this helper's callsites expect no output. - For the same reason as above, the whole 'test_expect_success' block is within a helper function, e.g. in 't3070-wildmatch.sh'. - Or 'test_cmp' is invoked in a loop, e.g. the test 'cvs update (-p)' in 't9400-git-cvsserver-server.sh'. Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

SZEDER Gábor committed Aug 19, 2018 at 23:57 UTC 1c5e94f459a0b7c23ef7e855441a65afdc4effab
46 files changed +114 -226
t/t0001-init.sh
+2 -3
@@ -167,9 +167,8 @@ test_expect_success 'reinit' '
167 ) &&
168 test_i18ngrep "Initialized empty" again/out1 &&
169 test_i18ngrep "Reinitialized existing" again/out2 &&
170 - >again/empty &&
171 - test_i18ncmp again/empty again/err1 &&
172 - test_i18ncmp again/empty again/err2
170 + test_must_be_empty again/err1 &&
171 + test_must_be_empty again/err2
172 '
173
174 test_expect_success 'init with --template' '
t/t0003-attributes.sh
+1 -2
@@ -208,9 +208,8 @@ test_expect_success 'attribute test: --all option' '
208 '
209
210 test_expect_success 'attribute test: --cached option' '
211 - : >empty &&
211 git check-attr --cached --stdin --all <stdin-all | sort >actual &&
213 - test_cmp empty actual &&
212 + test_must_be_empty actual &&
213 git add .gitattributes a/.gitattributes a/b/.gitattributes &&
214 git check-attr --cached --stdin --all <stdin-all | sort >actual &&
215 test_cmp specified-all actual
t/t0030-stripspace.sh
+9 -13
@@ -320,22 +320,20 @@ test_expect_success \
320
321 test_expect_success \
322 'spaces with newline at end should be replaced with empty string' '
323 - printf "" >expect &&
324 -
323 echo | git stripspace >actual &&
326 - test_cmp expect actual &&
324 + test_must_be_empty actual &&
325
326 echo "$sss" | git stripspace >actual &&
329 - test_cmp expect actual &&
327 + test_must_be_empty actual &&
328
329 echo "$sss$sss" | git stripspace >actual &&
332 - test_cmp expect actual &&
330 + test_must_be_empty actual &&
331
332 echo "$sss$sss$sss" | git stripspace >actual &&
335 - test_cmp expect actual &&
333 + test_must_be_empty actual &&
334
335 echo "$sss$sss$sss$sss" | git stripspace >actual &&
338 - test_cmp expect actual
336 + test_must_be_empty actual
337 '
338
339 test_expect_success \
@@ -349,19 +347,17 @@ test_expect_success \
347
348 test_expect_success \
349 'spaces without newline at end should be replaced with empty string' '
352 - printf "" >expect &&
353 -
350 printf "" | git stripspace >actual &&
355 - test_cmp expect actual &&
351 + test_must_be_empty actual &&
352
353 printf "$sss$sss" | git stripspace >actual &&
358 - test_cmp expect actual &&
354 + test_must_be_empty actual &&
355
356 printf "$sss$sss$sss" | git stripspace >actual &&
361 - test_cmp expect actual &&
357 + test_must_be_empty actual &&
358
359 printf "$sss$sss$sss$sss" | git stripspace >actual &&
364 - test_cmp expect actual
360 + test_must_be_empty actual
361 '
362
363 test_expect_success \
t/t0040-parse-options.sh
+1 -3
@@ -286,11 +286,9 @@ test_expect_success 'OPT_CALLBACK() and OPT_BIT() work' '
286 test_cmp expect output
287 '
288
289 ->expect
290 -
289 test_expect_success 'OPT_CALLBACK() and callback errors work' '
290 test_must_fail test-parse-options --no-length >output 2>output.err &&
293 - test_i18ncmp expect output &&
291 + test_must_be_empty output &&
292 test_must_be_empty output.err
293 '
294
t/t0061-run-command.sh
+4 -5
@@ -11,7 +11,6 @@ cat >hello-script <<-EOF
11 #!$SHELL_PATH
12 cat hello-script
13 EOF
14 ->empty
14
15 test_expect_success 'start_command reports ENOENT' '
16 test-tool run-command start-command-ENOENT ./does-not-exist
@@ -23,7 +22,7 @@ test_expect_success 'run_command can run a command' '
22 test-tool run-command run-command ./hello.sh >actual 2>err &&
23
24 test_cmp hello-script actual &&
26 - test_cmp empty err
25 + test_must_be_empty err
26 '
27
28 test_expect_success !MINGW 'run_command can run a script without a #! line' '
@@ -34,7 +33,7 @@ test_expect_success !MINGW 'run_command can run a script without a #! line' '
33 test-tool run-command run-command ./hello >actual 2>err &&
34
35 test_cmp hello-script actual &&
37 - test_cmp empty err
36 + test_must_be_empty err
37 '
38
39 test_expect_success 'run_command does not try to execute a directory' '
@@ -47,7 +46,7 @@ test_expect_success 'run_command does not try to execute a directory' '
46 PATH=$PWD/bin1:$PWD/bin2:$PATH \
47 test-tool run-command run-command greet >actual 2>err &&
48 test_cmp bin2/greet actual &&
50 - test_cmp empty err
49 + test_must_be_empty err
50 '
51
52 test_expect_success POSIXPERM 'run_command passes over non-executable file' '
@@ -64,7 +63,7 @@ test_expect_success POSIXPERM 'run_command passes over non-executable file' '
63 PATH=$PWD/bin1:$PWD/bin2:$PATH \
64 test-tool run-command run-command greet >actual 2>err &&
65 test_cmp bin2/greet actual &&
67 - test_cmp empty err
66 + test_must_be_empty err
67 '
68
69 test_expect_success POSIXPERM 'run_command reports EACCES' '
t/t1300-config.sh
+1 -4
@@ -346,12 +346,9 @@ test_expect_success 'working --list' '
346 git config --list > output &&
347 test_cmp expect output
348 '
349 -cat > expect << EOF
350 -EOF
351 -
349 test_expect_success '--list without repo produces empty output' '
350 git --git-dir=nonexistent config --list >output &&
354 - test_cmp expect output
351 + test_must_be_empty output
352 '
353
354 cat > expect << EOF
t/t1410-reflog.sh
+1 -2
@@ -290,9 +290,8 @@ test_expect_success 'stale dirs do not cause d/f conflicts (reflogs off)' '
290 # same as before, but we only create a reflog for "one" if
291 # it already exists, which it does not
292 git -c core.logallrefupdates=false branch one master &&
293 - : >expect &&
293 git log -g --format="%gd %gs" one >actual &&
295 - test_cmp expect actual
294 + test_must_be_empty actual
295 '
296
297 # Triggering the bug detected by this test requires a newline to fall
t/t1411-reflog-show.sh
+1 -2
@@ -136,13 +136,12 @@ test_expect_success '--date magic does not override explicit @{0} syntax' '
136 test_cmp expect actual
137 '
138
139 -: >expect
139 test_expect_success 'empty reflog file' '
140 git branch empty &&
141 git reflog expire --expire=all refs/heads/empty &&
142
143 git log -g empty >actual &&
145 - test_cmp expect actual
144 + test_must_be_empty actual
145 '
146
147 # This guards against the alternative of showing the diffs vs. the
t/t1450-fsck.sh
+5 -6
@@ -16,8 +16,7 @@ test_expect_success setup '
16 git checkout HEAD^0 &&
17 test_commit B fileB two &&
18 git tag -d A B &&
19 - git reflog expire --expire=now --all &&
20 - >empty
19 + git reflog expire --expire=now --all
20 '
21
22 test_expect_success 'loose objects borrowed from alternate are not missing' '
@@ -29,12 +28,12 @@ test_expect_success 'loose objects borrowed from alternate are not missing' '
28 test_commit C fileC one &&
29 git fsck --no-dangling >../actual 2>&1
30 ) &&
32 - test_cmp empty actual
31 + test_must_be_empty actual
32 '
33
34 test_expect_success 'HEAD is part of refs, valid objects appear valid' '
35 git fsck >actual 2>&1 &&
37 - test_cmp empty actual
36 + test_must_be_empty actual
37 '
38
39 # Corruption tests follow. Make sure to remove all traces of the
@@ -346,12 +345,12 @@ test_expect_success 'tag with NUL in header' '
345
346 test_expect_success 'cleaned up' '
347 git fsck >actual 2>&1 &&
349 - test_cmp empty actual
348 + test_must_be_empty actual
349 '
350
351 test_expect_success 'rev-list --verify-objects' '
352 git rev-list --verify-objects --all >/dev/null 2>out &&
354 - test_cmp empty out
353 + test_must_be_empty out
354 '
355
356 test_expect_success 'rev-list --verify-objects with bad sha1' '
t/t1600-index.sh
+1 -2
@@ -41,8 +41,7 @@ test_expect_success 'no warning with bogus GIT_INDEX_VERSION and existing index'
41 GIT_INDEX_VERSION=1 &&
42 export GIT_INDEX_VERSION &&
43 git add a 2>actual.err &&
44 - >expect.err &&
45 - test_i18ncmp expect.err actual.err
44 + test_must_be_empty actual.err
45 )
46 '
47
t/t1700-split-index.sh
+1 -3
@@ -143,9 +143,7 @@ test_expect_success 'remove file not in base index' '
143 test_expect_success 'remove file in base index' '
144 git update-index --force-remove one &&
145 git ls-files --stage >ls-files.actual &&
146 - cat >ls-files.expect <<-EOF &&
147 - EOF
148 - test_cmp ls-files.expect ls-files.actual &&
146 + test_must_be_empty ls-files.actual &&
147
148 test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
149 cat >expect <<-EOF &&
t/t2200-add-update.sh
+1 -2
@@ -88,9 +88,8 @@ test_expect_success 'non-qualified update in subdir updates from the root' '
88 echo even more >>sub2 &&
89 git add -u
90 ) &&
91 - : >expect &&
91 git diff-files --name-only >actual &&
93 - test_cmp expect actual
92 + test_must_be_empty actual
93 '
94
95 test_expect_success 'replace a file with a symlink' '
t/t2203-add-intent.sh
+2 -4
@@ -195,8 +195,7 @@ test_expect_success 'rename detection finds the right names' '
195 test_cmp expected.4 actual.4 &&
196
197 git diff --cached --stat >actual.5 &&
198 - : >expected.5 &&
199 - test_cmp expected.5 actual.5
198 + test_must_be_empty actual.5
199
200 )
201 '
@@ -241,8 +240,7 @@ test_expect_success 'diff-files/diff-cached shows ita as new/not-new files' '
240 echo " create mode 100644 new-ita" >expected &&
241 test_cmp expected actual &&
242 git diff --cached --summary >actual2 &&
244 - : >expected2 &&
245 - test_cmp expected2 actual2
243 + test_must_be_empty actual2
244 '
245
246
t/t3001-ls-files-others-exclude.sh
+2 -4
@@ -277,9 +277,8 @@ test_expect_success 'hide empty ignored sub-directory with --no-empty-directory'
277 '
278
279 test_expect_success 'pattern matches prefix completely' '
280 - : >expect &&
280 git ls-files -i -o --exclude "/three/a.3[abc]" >actual &&
282 - test_cmp expect actual
281 + test_must_be_empty actual
282 '
283
284 test_expect_success 'ls-files with "**" patterns' '
@@ -295,9 +294,8 @@ EOF
294
295
296 test_expect_success 'ls-files with "**" patterns and no slashes' '
298 - : >expect &&
297 git ls-files -o -i --exclude "one**a.1" >actual &&
300 - test_cmp expect actual
298 + test_must_be_empty actual
299 '
300
301 test_done
t/t3004-ls-files-basic.sh
+2 -4
@@ -8,16 +8,14 @@ command-line arguments.
8
9 . ./test-lib.sh
10
11 ->empty
12 -
11 test_expect_success 'ls-files in empty repository' '
12 git ls-files >actual &&
15 - test_cmp empty actual
13 + test_must_be_empty actual
14 '
15
16 test_expect_success 'ls-files with nonexistent path' '
17 git ls-files doesnotexist >actual &&
20 - test_cmp empty actual
18 + test_must_be_empty actual
19 '
20
21 test_expect_success 'ls-files with nonsense option' '
t/t3035-merge-sparse.sh
+2 -3
@@ -17,7 +17,6 @@ test_commit_this () {
17 }
18
19 test_expect_success 'setup' '
20 - : >empty &&
20 test_file checked-out init &&
21 test_file modify_delete modify_delete_init &&
22 test_commit_this init &&
@@ -38,7 +37,7 @@ test_expect_success 'reset --hard works after the conflict' '
37
38 test_expect_success 'is reset properly' '
39 git status --porcelain -- modify_delete >out &&
41 - test_cmp empty out &&
40 + test_must_be_empty out &&
41 test_path_is_missing modify_delete
42 '
43
@@ -52,7 +51,7 @@ test_expect_success 'Merge abort works after the conflict' '
51
52 test_expect_success 'is aborted properly' '
53 git status --porcelain -- modify_delete >out &&
55 - test_cmp empty out &&
54 + test_must_be_empty out &&
55 test_path_is_missing modify_delete
56 '
57
t/t3301-notes.sh
+1 -3
@@ -481,10 +481,8 @@ test_expect_success 'list specific note with "git notes list <object>"' '
481 '
482
483 test_expect_success 'listing non-existing notes fails' '
484 - cat >expect <<-EOF &&
485 - EOF
484 test_must_fail git notes list HEAD >actual &&
487 - test_cmp expect actual
485 + test_must_be_empty actual
486 '
487
488 test_expect_success 'append to existing note with "git notes append"' '
t/t3404-rebase-interactive.sh
+2 -3
@@ -787,16 +787,15 @@ test_expect_success 'always cherry-pick with --no-ff' '
787 git tag original-no-ff-branch &&
788 set_fake_editor &&
789 git rebase -i --no-ff A &&
790 - touch empty &&
790 for p in 0 1 2
791 do
792 test ! $(git rev-parse HEAD~$p) = $(git rev-parse original-no-ff-branch~$p) &&
793 git diff HEAD~$p original-no-ff-branch~$p > out &&
795 - test_cmp empty out
794 + test_must_be_empty out
795 done &&
796 test $(git rev-parse HEAD~3) = $(git rev-parse original-no-ff-branch~3) &&
797 git diff HEAD~3 original-no-ff-branch~3 > out &&
799 - test_cmp empty out
798 + test_must_be_empty out
799 '
800
801 test_expect_success 'set up commits with funny messages' '
t/t4015-diff-whitespace.sh
+1 -3
@@ -776,8 +776,6 @@ test_expect_success 'checkdiff allows new blank lines' '
776 git diff --check
777 '
778
779 -cat <<EOF >expect
780 -EOF
779 test_expect_success 'whitespace-only changes not reported' '
780 git reset --hard &&
781 echo >x "hello world" &&
@@ -785,7 +783,7 @@ test_expect_success 'whitespace-only changes not reported' '
783 git commit -m "hello 1" &&
784 echo >x "hello world" &&
785 git diff -b >actual &&
788 - test_cmp expect actual
786 + test_must_be_empty actual
787 '
788
789 cat <<EOF >expect
t/t4027-diff-submodule.sh
+1 -2
@@ -239,10 +239,9 @@ test_expect_success 'git diff between submodule commits [.gitmodules]' '
239 '
240
241 test_expect_success 'git diff (empty submodule dir)' '
242 - : >empty &&
242 rm -rf sub/* sub/.git &&
243 git diff > actual.empty &&
245 - test_cmp empty actual.empty
244 + test_must_be_empty actual.empty
245 '
246
247 test_expect_success 'conflicted submodule setup' '
t/t4041-diff-submodule-option.sh
+1 -3
@@ -257,9 +257,7 @@ test_expect_success 'typechanged submodule(blob->submodule)' '
257 commit_file sm1 &&
258 test_expect_success 'submodule is up to date' '
259 git diff-index -p --submodule=log HEAD >actual &&
260 - cat >expected <<-EOF &&
261 - EOF
262 - test_cmp expected actual
260 + test_must_be_empty actual
261 '
262
263 test_expect_success 'submodule contains untracked content' '
t/t4060-diff-submodule-option-diff-format.sh
+1 -3
@@ -392,9 +392,7 @@ test_expect_success 'typechanged submodule(blob->submodule)' '
392 commit_file sm1 &&
393 test_expect_success 'submodule is up to date' '
394 git diff-index -p --submodule=diff HEAD >actual &&
395 - cat >expected <<-EOF &&
396 - EOF
397 - test_cmp expected actual
395 + test_must_be_empty actual
396 '
397
398 test_expect_success 'submodule contains untracked content' '
t/t4132-apply-removal.sh
+2 -3
@@ -49,8 +49,7 @@ test_expect_success setup '
49 sed -e "s/TS0/$timeGMT/" -e "s/TS1/$epocGMT/" <d >removeGMT.patch &&
50 sed -e "s/TS0/$timeWest/" -e "s/TS1/$epocWest2/" <d >removeWest2.patch &&
51
52 - echo something >something &&
53 - >empty
52 + echo something >something
53 '
54
55 for patch in *.patch
@@ -81,7 +80,7 @@ do
80 git add file &&
81 git apply --index $patch &&
82 test -f file &&
84 - test_cmp empty file
83 + test_must_be_empty file
84 ;;
85 remove*)
86 # must remove the file
t/t4203-mailmap.sh
+1 -3
@@ -461,11 +461,9 @@ test_expect_success 'Grep author with log.mailmap' '
461 test_cmp expect actual
462 '
463
464 ->expect
465 -
464 test_expect_success 'Only grep replaced author with --use-mailmap' '
465 git log --use-mailmap --author "<cto@coompany.xx>" >actual &&
468 - test_cmp expect actual
466 + test_must_be_empty actual
467 '
468
469 # git blame
t/t4212-log-corrupt.sh
+2 -4
@@ -26,22 +26,20 @@ test_expect_success 'git log with broken author email' '
26 echo
27 echo " foo"
28 } >expect.out &&
29 - : >expect.err &&
29
30 git log broken_email >actual.out 2>actual.err &&
31
32 test_cmp expect.out actual.out &&
34 - test_cmp expect.err actual.err
33 + test_must_be_empty actual.err
34 '
35
36 test_expect_success 'git log --format with broken author email' '
37 echo "A U Thor+author@example.com+Thu Apr 7 15:13:13 2005 -0700" >expect.out &&
39 - : >expect.err &&
38
39 git log --format="%an+%ae+%ad" broken_email >actual.out 2>actual.err &&
40
41 test_cmp expect.out actual.out &&
44 - test_cmp expect.err actual.err
42 + test_must_be_empty actual.err
43 '
44
45 munge_author_date () {
t/t4300-merge-tree.sh
+7 -27
@@ -25,25 +25,19 @@ EXPECTED
25 '
26
27 test_expect_success 'file add !A, B' '
28 - cat >expected <<\EXPECTED &&
29 -EXPECTED
30 -
28 git reset --hard initial &&
29 test_commit "add-not-a-b" "ONE" "AAA" &&
30 git merge-tree initial add-not-a-b initial >actual &&
34 - test_cmp expected actual
31 + test_must_be_empty actual
32 '
33
34 test_expect_success 'file add A, B (same)' '
38 - cat >expected <<\EXPECTED &&
39 -EXPECTED
40 -
35 git reset --hard initial &&
36 test_commit "add-a-b-same-A" "ONE" "AAA" &&
37 git reset --hard initial &&
38 test_commit "add-a-b-same-B" "ONE" "AAA" &&
39 git merge-tree initial add-a-b-same-A add-a-b-same-B >actual &&
46 - test_cmp expected actual
40 + test_must_be_empty actual
41 '
42
43 test_expect_success 'file add A, B (different)' '
@@ -68,13 +62,10 @@ EXPECTED
62 '
63
64 test_expect_success 'file change A, !B' '
71 - cat >expected <<\EXPECTED &&
72 -EXPECTED
73 -
65 git reset --hard initial &&
66 test_commit "change-a-not-b" "initial-file" "BBB" &&
67 git merge-tree initial change-a-not-b initial >actual &&
77 - test_cmp expected actual
68 + test_must_be_empty actual
69 '
70
71 test_expect_success 'file change !A, B' '
@@ -94,15 +85,12 @@ EXPECTED
85 '
86
87 test_expect_success 'file change A, B (same)' '
97 - cat >expected <<\EXPECTED &&
98 -EXPECTED
99 -
88 git reset --hard initial &&
89 test_commit "change-a-b-same-A" "initial-file" "AAA" &&
90 git reset --hard initial &&
91 test_commit "change-a-b-same-B" "initial-file" "AAA" &&
92 git merge-tree initial change-a-b-same-A change-a-b-same-B >actual &&
105 - test_cmp expected actual
93 + test_must_be_empty actual
94 '
95
96 test_expect_success 'file change A, B (different)' '
@@ -175,16 +163,13 @@ AAA" &&
163 '
164
165 test_expect_success 'file remove A, !B' '
178 - cat >expected <<\EXPECTED &&
179 -EXPECTED
180 -
166 git reset --hard initial &&
167 test_commit "rm-a-not-b-base" "ONE" "AAA" &&
168 git rm ONE &&
169 git commit -m "rm-a-not-b" &&
170 git tag "rm-a-not-b" &&
171 git merge-tree rm-a-not-b-base rm-a-not-b rm-a-not-b-base >actual &&
187 - test_cmp expected actual
172 + test_must_be_empty actual
173 '
174
175 test_expect_success 'file remove !A, B' '
@@ -206,16 +191,13 @@ EXPECTED
191 '
192
193 test_expect_success 'file remove A, B (same)' '
209 - cat >expected <<\EXPECTED &&
210 -EXPECTED
211 -
194 git reset --hard initial &&
195 test_commit "rm-a-b-base" "ONE" "AAA" &&
196 git rm ONE &&
197 git commit -m "rm-a-b" &&
198 git tag "rm-a-b" &&
199 git merge-tree rm-a-b-base rm-a-b rm-a-b >actual &&
218 - test_cmp expected actual
200 + test_must_be_empty actual
201 '
202
203 test_expect_success 'file change A, remove B' '
@@ -260,13 +242,11 @@ EXPECTED
242 '
243
244 test_expect_success 'tree add A, B (same)' '
263 - cat >expect <<-\EOF &&
264 - EOF
245 git reset --hard initial &&
246 mkdir sub &&
247 test_commit "add sub/file" "sub/file" "file" add-tree-A &&
248 git merge-tree initial add-tree-A add-tree-A >actual &&
269 - test_cmp expect actual
249 + test_must_be_empty actual
250 '
251
252 test_expect_success 'tree add A, B (different)' '
t/t5304-prune.sh
+1 -2
@@ -112,8 +112,7 @@ test_expect_success 'prune: do not prune detached HEAD with no reflog' '
112 # (should be removed and disabled by previous test)
113 test_path_is_missing .git/logs &&
114 git prune -n >prune_actual &&
115 - : >prune_expected &&
116 - test_cmp prune_actual prune_expected
115 + test_must_be_empty prune_actual
116
117 '
118
t/t5314-pack-cycle-detection.sh
+1 -2
@@ -98,9 +98,8 @@ test_expect_success 'repack' '
98 # We first want to check that we do not have any internal errors,
99 # and also that we do not hit the last-ditch cycle-breaking code
100 # in write_object(), which will issue a warning to stderr.
101 - >expect &&
101 git repack -ad 2>stderr &&
103 - test_cmp expect stderr &&
102 + test_must_be_empty stderr &&
103
104 # And then double-check that the resulting pack is usable (i.e.,
105 # we did not fail to notice any cycles). We know we are accessing
t/t5526-fetch-submodules.sh
+1 -2
@@ -495,7 +495,6 @@ test_expect_success "'fetch.recurseSubmodules=on-demand' works also without .git
495 git add submodule &&
496 git rm .gitmodules &&
497 git commit -m "new submodule without .gitmodules" &&
498 - printf "" >expect.out &&
498 head2=$(git rev-parse --short HEAD) &&
499 echo "From $pwd/." >expect.err.2 &&
500 echo " $head1..$head2 master -> origin/master" >>expect.err.2 &&
@@ -514,7 +513,7 @@ test_expect_success "'fetch.recurseSubmodules=on-demand' works also without .git
513 git config --unset fetch.recurseSubmodules &&
514 git reset --hard
515 ) &&
517 - test_i18ncmp expect.out actual.out &&
516 + test_must_be_empty actual.out &&
517 test_i18ncmp expect.err.2 actual.err &&
518 git checkout HEAD^ -- .gitmodules &&
519 git add .gitmodules &&
t/t6112-rev-list-filters-objects.sh
+1 -2
@@ -113,12 +113,11 @@ test_expect_success 'verify blob:limit=1k' '
113 '
114
115 test_expect_success 'verify blob:limit=1m' '
116 - cat </dev/null >expected &&
116 git -C r2 rev-list HEAD --quiet --objects --filter-print-omitted --filter=blob:limit=1m \
117 | awk -f print_1.awk \
118 | sed "s/~//" \
119 | sort >observed &&
121 - test_cmp observed expected
120 + test_must_be_empty observed
121 '
122
123 # Test sparse:path=<path> filter.
t/t6120-describe.sh
+1 -2
@@ -121,10 +121,9 @@ test_expect_success 'describe --contains defaults to HEAD without commit-ish' '
121 test_cmp expect actual
122 '
123
124 -: >err.expect
124 check_describe tags/A --all A^0
125 test_expect_success 'no warning was displayed for A' '
127 - test_cmp err.expect err.actual
126 + test_must_be_empty err.actual
127 '
128
129 test_expect_success 'rename tag A to Q locally' '
t/t6130-pathspec-noglob.sh
+3 -6
@@ -97,9 +97,8 @@ test_expect_success 'no-glob option matches literally (bracket)' '
97 '
98
99 test_expect_success 'no-glob option disables :(literal)' '
100 - : >expect &&
100 git --literal-pathspecs log --format=%s -- ":(literal)foo" >actual &&
102 - test_cmp expect actual
101 + test_must_be_empty actual
102 '
103
104 test_expect_success 'no-glob environment variable works' '
@@ -130,9 +129,8 @@ test_expect_success '**/ works with :(glob)' '
129 '
130
131 test_expect_success '**/ does not work with --noglob-pathspecs' '
133 - : >expect &&
132 git --noglob-pathspecs log --format=%s -- "**/bar" >actual &&
135 - test_cmp expect actual
133 + test_must_be_empty actual
134 '
135
136 test_expect_success '**/ works with :(glob) and --noglob-pathspecs' '
@@ -154,9 +152,8 @@ test_expect_success '**/ works with --glob-pathspecs' '
152 '
153
154 test_expect_success '**/ does not work with :(literal) and --glob-pathspecs' '
157 - : >expect &&
155 git --glob-pathspecs log --format=%s -- ":(literal)**/bar" >actual &&
159 - test_cmp expect actual
156 + test_must_be_empty actual
157 '
158
159 test_done
t/t6200-fmt-merge-msg.sh
+1 -3
@@ -366,8 +366,6 @@ test_expect_success 'merge-msg with nothing to merge' '
366 test_unconfig merge.log &&
367 test_config merge.summary yes &&
368
369 - >empty &&
370 -
369 (
370 cd remote &&
371 git checkout -b unrelated &&
@@ -376,7 +374,7 @@ test_expect_success 'merge-msg with nothing to merge' '
374 git fmt-merge-msg <.git/FETCH_HEAD >../actual
375 ) &&
376
379 - test_cmp empty actual
377 + test_must_be_empty actual
378 '
379
380 test_expect_success 'merge-msg tag' '
t/t7004-tag.sh
+2 -6
@@ -325,11 +325,10 @@ test_expect_success \
325 test_cmp expect actual
326 '
327
328 ->expect
328 test_expect_success \
329 'listing tags using v.* should print nothing because none have v.' '
330 git tag -l "v.*" > actual &&
332 - test_cmp expect actual
331 + test_must_be_empty actual
332 '
333
334 cat >expect <<EOF
@@ -1498,12 +1497,9 @@ test_expect_success 'inverse of the last test, with --no-contains' "
1497 test_cmp expected actual
1498 "
1499
1501 -cat > expected <<EOF
1502 -EOF
1503 -
1500 test_expect_success 'checking that third commit has no tags' "
1501 git tag -l --contains $hash3 v* >actual &&
1506 - test_cmp expected actual
1502 + test_must_be_empty actual
1503 "
1504
1505 cat > expected <<EOF
t/t7008-grep-binary.sh
+2 -4
@@ -57,9 +57,8 @@ test_expect_success 'git grep -ah ina a' '
57 '
58
59 test_expect_success 'git grep -I ina a' '
60 - : >expect &&
60 test_must_fail git grep -I ina a >actual &&
62 - test_cmp expect actual
61 + test_must_be_empty actual
62 '
63
64 test_expect_success 'git grep -c ina a' '
@@ -81,9 +80,8 @@ test_expect_success 'git grep -L bar a' '
80 '
81
82 test_expect_success 'git grep -q ina a' '
84 - : >expect &&
83 git grep -q ina a >actual &&
86 - test_cmp expect actual
84 + test_must_be_empty actual
85 '
86
87 test_expect_success 'git grep -F ile a' '
t/t7064-wtstatus-pv2.sh
+1 -4
@@ -364,11 +364,8 @@ test_expect_success 'verify upstream fields in branch header' '
364 test_cmp expect actual &&
365
366 ## Repeat the above but without --branch.
367 - cat >expect <<-EOF &&
368 - EOF
369 -
367 git status --porcelain=v2 --untracked-files=all >actual &&
371 - test_cmp expect actual &&
368 + test_must_be_empty actual &&
369
370 ## Test upstream-gone case. Fake this by pointing origin/master at
371 ## a non-existing commit.
t/t7201-co.sh
+1 -2
@@ -116,9 +116,8 @@ test_expect_success "checkout -m with dirty tree" '
116 git diff --name-status side >current.side &&
117 test_cmp expect.side current.side &&
118
119 - : >expect.index &&
119 git diff --cached >current.index &&
121 - test_cmp expect.index current.index
120 + test_must_be_empty current.index
121 '
122
123 test_expect_success "checkout -m with dirty tree, renamed" '
t/t7400-submodule-basic.sh
+9 -19
@@ -101,7 +101,6 @@ inspect() {
101
102 test_expect_success 'submodule add' '
103 echo "refs/heads/master" >expect &&
104 - >empty &&
104
105 (
106 cd addtest &&
@@ -123,7 +122,7 @@ test_expect_success 'submodule add' '
122 inspect addtest/submod ../.. &&
123 test_cmp expect heads &&
124 test_cmp expect head &&
126 - test_cmp empty untracked
125 + test_must_be_empty untracked
126 '
127
128 test_expect_success 'setup parent and one repository' '
@@ -188,7 +187,6 @@ test_expect_success 'submodule add --branch' '
187 refs/heads/initial
188 refs/heads/master
189 EOF
191 - >empty &&
190
191 (
192 cd addtest &&
@@ -201,12 +199,11 @@ test_expect_success 'submodule add --branch' '
199 inspect addtest/submod-branch ../.. &&
200 test_cmp expect-heads heads &&
201 test_cmp expect-head head &&
204 - test_cmp empty untracked
202 + test_must_be_empty untracked
203 '
204
205 test_expect_success 'submodule add with ./ in path' '
206 echo "refs/heads/master" >expect &&
209 - >empty &&
207
208 (
209 cd addtest &&
@@ -218,12 +215,11 @@ test_expect_success 'submodule add with ./ in path' '
215 inspect addtest/dotsubmod/frotz ../../.. &&
216 test_cmp expect heads &&
217 test_cmp expect head &&
221 - test_cmp empty untracked
218 + test_must_be_empty untracked
219 '
220
221 test_expect_success 'submodule add with /././ in path' '
222 echo "refs/heads/master" >expect &&
226 - >empty &&
223
224 (
225 cd addtest &&
@@ -235,12 +231,11 @@ test_expect_success 'submodule add with /././ in path' '
231 inspect addtest/dotslashdotsubmod/frotz ../../.. &&
232 test_cmp expect heads &&
233 test_cmp expect head &&
238 - test_cmp empty untracked
234 + test_must_be_empty untracked
235 '
236
237 test_expect_success 'submodule add with // in path' '
238 echo "refs/heads/master" >expect &&
243 - >empty &&
239
240 (
241 cd addtest &&
@@ -252,12 +247,11 @@ test_expect_success 'submodule add with // in path' '
247 inspect addtest/slashslashsubmod/frotz ../../.. &&
248 test_cmp expect heads &&
249 test_cmp expect head &&
255 - test_cmp empty untracked
250 + test_must_be_empty untracked
251 '
252
253 test_expect_success 'submodule add with /.. in path' '
254 echo "refs/heads/master" >expect &&
260 - >empty &&
255
256 (
257 cd addtest &&
@@ -269,12 +263,11 @@ test_expect_success 'submodule add with /.. in path' '
263 inspect addtest/realsubmod ../.. &&
264 test_cmp expect heads &&
265 test_cmp expect head &&
272 - test_cmp empty untracked
266 + test_must_be_empty untracked
267 '
268
269 test_expect_success 'submodule add with ./, /.. and // in path' '
270 echo "refs/heads/master" >expect &&
277 - >empty &&
271
272 (
273 cd addtest &&
@@ -286,7 +279,7 @@ test_expect_success 'submodule add with ./, /.. and // in path' '
279 inspect addtest/realsubmod2 ../.. &&
280 test_cmp expect heads &&
281 test_cmp expect head &&
289 - test_cmp empty untracked
282 + test_must_be_empty untracked
283 '
284
285 test_expect_success !CYGWIN 'submodule add with \\ in path' '
@@ -305,7 +298,6 @@ test_expect_success !CYGWIN 'submodule add with \\ in path' '
298
299 test_expect_success 'submodule add in subdirectory' '
300 echo "refs/heads/master" >expect &&
308 - >empty &&
301
302 mkdir addtest/sub &&
303 (
@@ -318,7 +310,7 @@ test_expect_success 'submodule add in subdirectory' '
310 inspect addtest/realsubmod3 ../.. &&
311 test_cmp expect heads &&
312 test_cmp expect head &&
321 - test_cmp empty untracked
313 + test_must_be_empty untracked
314 '
315
316 test_expect_success 'submodule add in subdirectory with relative path should fail' '
@@ -501,8 +493,6 @@ test_expect_success 'checkout superproject with subproject already present' '
493 '
494
495 test_expect_success 'apply submodule diff' '
504 - >empty &&
505 -
496 git branch second &&
497 (
498 cd init &&
@@ -517,7 +507,7 @@ test_expect_success 'apply submodule diff' '
507 git apply --index P.diff &&
508
509 git diff --cached master >staged &&
520 - test_cmp empty staged
510 + test_must_be_empty staged
511 '
512
513 test_expect_success 'update --init' '
t/t7501-commit.sh
+2 -4
@@ -582,13 +582,11 @@ test_expect_success 'same tree (merge and amend merge)' '
582
583 git merge -s ours side -m "empty ok" &&
584 git diff HEAD^ HEAD >actual &&
585 - : >expected &&
586 - test_cmp expected actual &&
585 + test_must_be_empty actual &&
586
587 git commit --amend -m "empty really ok" &&
588 git diff HEAD^ HEAD >actual &&
590 - : >expected &&
591 - test_cmp expected actual
589 + test_must_be_empty actual
590
591 '
592
t/t7600-merge.sh
+3 -6
@@ -38,7 +38,6 @@ printf '%s\n' '1 X' 2 3 4 5 6 7 8 9 >result.1
38 printf '%s\n' '1 X' 2 3 4 '5 X' 6 7 8 9 >result.1-5
39 printf '%s\n' '1 X' 2 3 4 '5 X' 6 7 8 '9 X' >result.1-5-9
40 printf '%s\n' 1 2 3 4 5 6 7 8 '9 Z' >result.9z
41 ->empty
41
42 create_merge_msgs () {
43 echo "Merge tag 'c2'" >msg.1-5 &&
@@ -58,8 +57,6 @@ create_merge_msgs () {
57 echo &&
58 git log --no-merges ^HEAD c2 c3
59 } >squash.1-5-9 &&
61 - : >msg.nologff &&
62 - : >msg.nolognoff &&
60 {
61 echo "* tag 'c3':" &&
62 echo " commit 3"
@@ -519,7 +516,7 @@ test_expect_success 'tolerate unknown values for merge.ff' '
516 test_tick &&
517 git merge c1 2>message &&
518 verify_head "$c1" &&
522 - test_cmp empty message
519 + test_must_be_empty message
520 '
521
522 test_expect_success 'combining --squash and --no-ff is refused' '
@@ -551,13 +548,13 @@ test_expect_success 'merge log message' '
548 git reset --hard c0 &&
549 git merge --no-log c2 &&
550 git show -s --pretty=format:%b HEAD >msg.act &&
554 - test_cmp msg.nologff msg.act &&
551 + test_must_be_empty msg.act &&
552
553 git reset --hard c0 &&
554 test_config branch.master.mergeoptions "--no-ff" &&
555 git merge --no-log c2 &&
556 git show -s --pretty=format:%b HEAD >msg.act &&
560 - test_cmp msg.nolognoff msg.act &&
557 + test_must_be_empty msg.act &&
558
559 git merge --log c3 &&
560 git show -s --pretty=format:%b HEAD >msg.act &&
t/t7610-mergetool.sh
+1 -2
@@ -328,9 +328,8 @@ test_expect_success 'mergetool produces no errors when keepBackup is used' '
328 git checkout -b test$test_count move-to-c &&
329 test_config mergetool.keepBackup true &&
330 test_must_fail git merge move-to-b &&
331 - : >expect &&
331 echo d | git mergetool a/a/file.txt 2>actual &&
333 - test_cmp expect actual &&
332 + test_must_be_empty actual &&
333 ! test -d a
334 '
335
t/t7810-grep.sh
+11 -20
@@ -217,9 +217,8 @@ do
217 '
218
219 test_expect_success "grep -w $L (w)" '
220 - : >expected &&
220 test_must_fail git grep -n -w -e "^w" $H >actual &&
222 - test_cmp expected actual
221 + test_must_be_empty actual
222 '
223
224 test_expect_success "grep -w $L (x)" '
@@ -239,26 +238,24 @@ do
238 '
239
240 test_expect_success "grep -w $L (y-2)" '
242 - : >expected &&
241 if git grep -n -w -e "^y y" $H >actual
242 then
243 echo should not have matched
244 cat actual
245 false
246 else
249 - test_cmp expected actual
247 + test_must_be_empty actual
248 fi
249 '
250
251 test_expect_success "grep -w $L (z)" '
254 - : >expected &&
252 if git grep -n -w -e "^z" $H >actual
253 then
254 echo should not have matched
255 cat actual
256 false
257 else
261 - test_cmp expected actual
258 + test_must_be_empty actual
259 fi
260 '
261
@@ -604,11 +601,10 @@ z:zzz
601 EOF
602
603 test_expect_success 'grep -q, silently report matches' '
607 - >empty &&
604 git grep -q mmap >actual &&
609 - test_cmp empty actual &&
605 + test_must_be_empty actual &&
606 test_must_fail git grep -q qfwfq >actual &&
611 - test_cmp empty actual
607 + test_must_be_empty actual
608 '
609
610 test_expect_success 'grep -C1 hunk mark between files' '
@@ -701,8 +697,7 @@ test_expect_success 'log grep (9)' '
697
698 test_expect_success 'log grep (9)' '
699 git log -g --grep-reflog="commit: third" --author="non-existent" --pretty=tformat:%s >actual &&
704 - : >expect &&
705 - test_cmp expect actual
700 + test_must_be_empty actual
701 '
702
703 test_expect_success 'log --grep-reflog can only be used under -g' '
@@ -792,15 +787,13 @@ test_expect_success 'log --all-match --grep --grep --author takes intersection'
787 '
788
789 test_expect_success 'log --author does not search in timestamp' '
795 - : >expect &&
790 git log --author="$GIT_AUTHOR_DATE" >actual &&
797 - test_cmp expect actual
791 + test_must_be_empty actual
792 '
793
794 test_expect_success 'log --committer does not search in timestamp' '
801 - : >expect &&
795 git log --committer="$GIT_COMMITTER_DATE" >actual &&
803 - test_cmp expect actual
796 + test_must_be_empty actual
797 '
798
799 test_expect_success 'grep with CE_VALID file' '
@@ -1051,13 +1044,12 @@ test_expect_success 'inside git repository but with --no-index' '
1044 echo ".gitignore:.*o*" &&
1045 cat is/expect.unignored
1046 } >is/expect.full &&
1054 - : >is/expect.empty &&
1047 echo file2:world >is/expect.sub &&
1048 (
1049 cd is/git &&
1050 git init &&
1051 test_must_fail git grep o >../actual.full &&
1060 - test_cmp ../expect.empty ../actual.full &&
1052 + test_must_be_empty ../actual.full &&
1053
1054 git grep --untracked o >../actual.unignored &&
1055 test_cmp ../expect.unignored ../actual.unignored &&
@@ -1070,7 +1062,7 @@ test_expect_success 'inside git repository but with --no-index' '
1062
1063 cd sub &&
1064 test_must_fail git grep o >../../actual.sub &&
1073 - test_cmp ../../expect.empty ../../actual.sub &&
1065 + test_must_be_empty ../../actual.sub &&
1066
1067 git grep --no-index o >../../actual.sub &&
1068 test_cmp ../../expect.sub ../../actual.sub &&
@@ -1236,10 +1228,9 @@ test_expect_success !PCRE 'grep -P pattern errors without PCRE' '
1228 '
1229
1230 test_expect_success 'grep pattern with grep.extendedRegexp=true' '
1239 - >empty &&
1231 test_must_fail git -c grep.extendedregexp=true \
1232 grep "\p{Ps}.*?\p{Pe}" hello.c >actual &&
1242 - test_cmp empty actual
1233 + test_must_be_empty actual
1234 '
1235
1236 test_expect_success PCRE 'grep -P pattern with grep.extendedRegexp=true' '
t/t7811-grep-open.sh
+7 -11
@@ -51,14 +51,13 @@ test_expect_success SIMPLEPAGER 'git grep -O' '
51 grep.h
52 EOF
53 echo grep.h >expect.notless &&
54 - >empty &&
54
55 PATH=.:$PATH git grep -O GREP_PATTERN >out &&
56 {
57 test_cmp expect.less pager-args ||
58 test_cmp expect.notless pager-args
59 } &&
61 - test_cmp empty out
60 + test_must_be_empty out
61 '
62
63 test_expect_success 'git grep -O --cached' '
@@ -72,7 +71,6 @@ test_expect_success 'git grep -O --no-index' '
71 grep.h
72 untracked
73 EOF
75 - >empty &&
74
75 (
76 GIT_PAGER='\''printf "%s\n" >pager-args'\'' &&
@@ -80,7 +78,7 @@ test_expect_success 'git grep -O --no-index' '
78 git grep --no-index -O GREP_PATTERN >out
79 ) &&
80 test_cmp expect pager-args &&
83 - test_cmp empty out
81 + test_must_be_empty out
82 '
83
84 test_expect_success 'setup: fake "less"' '
@@ -96,15 +94,14 @@ test_expect_success 'git grep -O jumps to line in less' '
94 +/*GREP_PATTERN
95 grep.h
96 EOF
99 - >empty &&
97
98 GIT_PAGER=./less git grep -O GREP_PATTERN >out &&
99 test_cmp expect actual &&
103 - test_cmp empty out &&
100 + test_must_be_empty out &&
101
102 git grep -O./less GREP_PATTERN >out2 &&
103 test_cmp expect actual &&
107 - test_cmp empty out2
104 + test_must_be_empty out2
105 '
106
107 test_expect_success 'modified file' '
@@ -122,7 +119,7 @@ test_expect_success 'modified file' '
119 test_when_finished "git checkout HEAD unrelated" &&
120 GIT_PAGER=./less git grep -F -O "enum grep_pat_token" >out &&
121 test_cmp expect actual &&
125 - test_cmp empty out
122 + test_must_be_empty out
123 '
124
125 test_expect_success 'copes with color settings' '
@@ -138,7 +135,6 @@ test_expect_success 'copes with color settings' '
135 test_expect_success 'run from subdir' '
136 rm -f actual &&
137 echo grep.c >expect &&
141 - >empty &&
138
139 (
140 cd subdir &&
@@ -156,8 +152,8 @@ test_expect_success 'run from subdir' '
152 ;;
153 esac &&
154 test_cmp expect args &&
159 - test_cmp empty out &&
160 - test_cmp empty out2
155 + test_must_be_empty out &&
156 + test_must_be_empty out2
157 '
158
159 test_done
t/t9011-svn-da.sh
+7 -7
@@ -18,7 +18,7 @@ test_expect_success 'reject empty delta' '
18 test_expect_success 'delta can empty file' '
19 printf "SVNQ" | q_to_nul >clear.delta &&
20 test-svn-fe -d preimage clear.delta 4 >actual &&
21 - test_cmp empty actual
21 + test_must_be_empty actual
22 '
23
24 test_expect_success 'reject svndiff2' '
@@ -29,7 +29,7 @@ test_expect_success 'reject svndiff2' '
29 test_expect_success 'one-window empty delta' '
30 printf "SVNQ%s" "QQQQQ" | q_to_nul >clear.onewindow &&
31 test-svn-fe -d preimage clear.onewindow 9 >actual &&
32 - test_cmp empty actual
32 + test_must_be_empty actual
33 '
34
35 test_expect_success 'reject incomplete window header' '
@@ -50,7 +50,7 @@ test_expect_success 'two-window empty delta' '
50 printf "SVNQ%s%s" "QQQQQ" "QQQQQ" | q_to_nul >clear.twowindow &&
51 test-svn-fe -d preimage clear.twowindow 14 >actual &&
52 test_must_fail test-svn-fe -d preimage clear.twowindow 13 &&
53 - test_cmp empty actual
53 + test_must_be_empty actual
54 '
55
56 test_expect_success 'noisy zeroes' '
@@ -60,7 +60,7 @@ test_expect_success 'noisy zeroes' '
60 q_to_nul >clear.noisy &&
61 len=$(wc -c <clear.noisy) &&
62 test-svn-fe -d preimage clear.noisy $len &&
63 - test_cmp empty actual
63 + test_must_be_empty actual
64 '
65
66 test_expect_success 'reject variable-length int in magic' '
@@ -83,7 +83,7 @@ test_expect_success 'reject truncated integer' '
83 test_expect_success 'nonempty (but unused) preimage view' '
84 printf "SVNQ%b" "Q\003QQQ" | q_to_nul >clear.readpreimage &&
85 test-svn-fe -d preimage clear.readpreimage 9 >actual &&
86 - test_cmp empty actual
86 + test_must_be_empty actual
87 '
88
89 test_expect_success 'preimage view: right endpoint cannot backtrack' '
@@ -99,7 +99,7 @@ test_expect_success 'preimage view: left endpoint can advance' '
99 q_to_nul >clear.shrinkbacktrack &&
100 test-svn-fe -d preimage clear.preshrink 14 >actual &&
101 test_must_fail test-svn-fe -d preimage clear.shrinkbacktrack 14 &&
102 - test_cmp empty actual
102 + test_must_be_empty actual
103 '
104
105 test_expect_success 'preimage view: offsets compared by value' '
@@ -109,7 +109,7 @@ test_expect_success 'preimage view: offsets compared by value' '
109 q_to_nul >clear.noisyadvance &&
110 test_must_fail test-svn-fe -d preimage clear.noisybacktrack 15 &&
111 test-svn-fe -d preimage clear.noisyadvance 15 &&
112 - test_cmp empty actual
112 + test_must_be_empty actual
113 '
114
115 test_expect_success 'preimage view: reject truncated preimage' '
t/t9200-git-cvsexportcommit.sh
+2 -2
@@ -43,11 +43,11 @@ check_entries () {
43 sed -ne '/^\//p' "$1/CVS/Entries" | sort | cut -d/ -f2,3,5 >actual
44 if test -z "$2"
45 then
46 - >expected
46 + test_must_be_empty actual
47 else
48 printf '%s\n' "$2" | tr '|' '\012' >expected
49 + test_cmp expected actual
50 fi
50 - test_cmp expected actual
51 }
52
53 test_expect_success \
t/t9903-bash-prompt.sh
+2 -4
@@ -516,10 +516,9 @@ test_expect_success 'prompt - format string starting with dash' '
516
517 test_expect_success 'prompt - pc mode' '
518 printf "BEFORE: (\${__git_ps1_branch_name}):AFTER\\nmaster" >expected &&
519 - printf "" >expected_output &&
519 (
520 __git_ps1 "BEFORE:" ":AFTER" >"$actual" &&
522 - test_cmp expected_output "$actual" &&
521 + test_must_be_empty "$actual" &&
522 printf "%s\\n%s" "$PS1" "${__git_ps1_branch_name}" >"$actual"
523 ) &&
524 test_cmp expected "$actual"
@@ -715,13 +714,12 @@ test_expect_success 'prompt - hide if pwd ignored - env var set, config disabled
714 '
715
716 test_expect_success 'prompt - hide if pwd ignored - env var set, config unset' '
718 - printf "" >expected &&
717 (
718 cd ignored_dir &&
719 GIT_PS1_HIDE_IF_PWD_IGNORED=y &&
720 __git_ps1 >"$actual"
721 ) &&
724 - test_cmp expected "$actual"
722 + test_must_be_empty "$actual"
723 '
724
725 test_expect_success 'prompt - hide if pwd ignored - env var set, config unset, pc mode' '