test: fix '&&' chaining

Breaks in a test assertion's && chain can potentially hide failures from earlier commands in the chain by adding " &&" at the end of line to the commands that need them. Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> Acked-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ramkumar Ramachandra committed Dec 8, 2011 at 18:40 UTC 02380389c6d4656c0cc94d33f9811636cb5953e4
10 files changed +17 -17
t/t1007-hash-object.sh
+1 -1
@@ -189,7 +189,7 @@ for args in "-w --stdin-paths" "--stdin-paths -w"; do
189 done
190
191 test_expect_success 'corrupt tree' '
192 - echo abc >malformed-tree
192 + echo abc >malformed-tree &&
193 test_must_fail git hash-object -t tree malformed-tree
194 '
195
t/t1013-loose-object-format.sh
+1 -1
@@ -34,7 +34,7 @@ assert_blob_equals() {
34 }
35
36 test_expect_success setup '
37 - cp -R "$TEST_DIRECTORY/t1013/objects" .git/
37 + cp -R "$TEST_DIRECTORY/t1013/objects" .git/ &&
38 git --version
39 '
40
t/t1300-repo-config.sh
+1 -1
@@ -38,7 +38,7 @@ cat > expect << EOF
38 WhatEver = Second
39 EOF
40 test_expect_success 'similar section' '
41 - git config Cores.WhatEver Second
41 + git config Cores.WhatEver Second &&
42 test_cmp expect .git/config
43 '
44
t/t1412-reflog-loop.sh
+1 -1
@@ -20,7 +20,7 @@ test_expect_success 'setup reflog with alternating commits' '
20 '
21
22 test_expect_success 'reflog shows all entries' '
23 - cat >expect <<-\EOF
23 + cat >expect <<-\EOF &&
24 topic@{0} reset: moving to two
25 topic@{1} reset: moving to one
26 topic@{2} reset: moving to two
t/t1510-repo-setup.sh
+2 -2
@@ -603,7 +603,7 @@ test_expect_success '#22a: core.worktree = GIT_DIR = .git dir' '
603 # like case #6.
604
605 setup_repo 22a "$here/22a/.git" "" unset &&
606 - setup_repo 22ab . "" unset
606 + setup_repo 22ab . "" unset &&
607 mkdir -p 22a/.git/sub 22a/sub &&
608 mkdir -p 22ab/.git/sub 22ab/sub &&
609 try_case 22a/.git unset . \
@@ -742,7 +742,7 @@ test_expect_success '#28: core.worktree and core.bare conflict (gitfile case)' '
742 # Case #29: GIT_WORK_TREE(+core.worktree) overrides core.bare (gitfile case).
743 test_expect_success '#29: setup' '
744 setup_repo 29 non-existent gitfile true &&
745 - mkdir -p 29/sub/sub 29/wt/sub
745 + mkdir -p 29/sub/sub 29/wt/sub &&
746 (
747 cd 29 &&
748 GIT_WORK_TREE="$here/29" &&
t/t1511-rev-parse-caret.sh
+1 -1
@@ -6,7 +6,7 @@ test_description='tests for ref^{stuff}'
6
7 test_expect_success 'setup' '
8 echo blob >a-blob &&
9 - git tag -a -m blob blob-tag `git hash-object -w a-blob`
9 + git tag -a -m blob blob-tag `git hash-object -w a-blob` &&
10 mkdir a-tree &&
11 echo moreblobs >a-tree/another-blob &&
12 git add . &&
t/t3310-notes-merge-manual-resolve.sh
+5 -5
@@ -389,7 +389,7 @@ test_expect_success 'abort notes merge' '
389 test_must_fail ls .git/NOTES_MERGE_* >output 2>/dev/null &&
390 test_cmp /dev/null output &&
391 # m has not moved (still == y)
392 - test "$(git rev-parse refs/notes/m)" = "$(cat pre_merge_y)"
392 + test "$(git rev-parse refs/notes/m)" = "$(cat pre_merge_y)" &&
393 # Verify that other notes refs has not changed (w, x, y and z)
394 verify_notes w &&
395 verify_notes x &&
@@ -525,9 +525,9 @@ EOF
525 test -f .git/NOTES_MERGE_WORKTREE/$commit_sha3 &&
526 test -f .git/NOTES_MERGE_WORKTREE/$commit_sha4 &&
527 # Refs are unchanged
528 - test "$(git rev-parse refs/notes/m)" = "$(git rev-parse refs/notes/w)"
529 - test "$(git rev-parse refs/notes/y)" = "$(git rev-parse NOTES_MERGE_PARTIAL^1)"
530 - test "$(git rev-parse refs/notes/m)" != "$(git rev-parse NOTES_MERGE_PARTIAL^1)"
528 + test "$(git rev-parse refs/notes/m)" = "$(git rev-parse refs/notes/w)" &&
529 + test "$(git rev-parse refs/notes/y)" = "$(git rev-parse NOTES_MERGE_PARTIAL^1)" &&
530 + test "$(git rev-parse refs/notes/m)" != "$(git rev-parse NOTES_MERGE_PARTIAL^1)" &&
531 # Mention refs/notes/m, and its current and expected value in output
532 grep -q "refs/notes/m" output &&
533 grep -q "$(git rev-parse refs/notes/m)" output &&
@@ -545,7 +545,7 @@ test_expect_success 'resolve situation by aborting the notes merge' '
545 test_must_fail ls .git/NOTES_MERGE_* >output 2>/dev/null &&
546 test_cmp /dev/null output &&
547 # m has not moved (still == w)
548 - test "$(git rev-parse refs/notes/m)" = "$(git rev-parse refs/notes/w)"
548 + test "$(git rev-parse refs/notes/m)" = "$(git rev-parse refs/notes/w)" &&
549 # Verify that other notes refs has not changed (w, x, y and z)
550 verify_notes w &&
551 verify_notes x &&
t/t3400-rebase.sh
+2 -2
@@ -172,8 +172,8 @@ test_expect_success 'fail when upstream arg is missing and not configured' '
172
173 test_expect_success 'default to @{upstream} when upstream arg is missing' '
174 git checkout -b default topic &&
175 - git config branch.default.remote .
176 - git config branch.default.merge refs/heads/master
175 + git config branch.default.remote . &&
176 + git config branch.default.merge refs/heads/master &&
177 git rebase &&
178 test "$(git rev-parse default~1)" = "$(git rev-parse master)"
179 '
t/t3418-rebase-continue.sh
+2 -2
@@ -51,7 +51,7 @@ test_expect_success 'rebase --continue remembers merge strategy and options' '
51 test_commit "commit-new-file-F3-on-topic-branch" F3 32 &&
52 test_when_finished "rm -fr test-bin funny.was.run" &&
53 mkdir test-bin &&
54 - cat >test-bin/git-merge-funny <<-EOF
54 + cat >test-bin/git-merge-funny <<-EOF &&
55 #!$SHELL_PATH
56 case "\$1" in --opt) ;; *) exit 2 ;; esac
57 shift &&
@@ -77,7 +77,7 @@ test_expect_success 'rebase --continue remembers merge strategy and options' '
77 test_expect_success 'rebase --continue remembers --rerere-autoupdate' '
78 rm -fr .git/rebase-* &&
79 git reset --hard commit-new-file-F3-on-topic-branch &&
80 - git checkout master
80 + git checkout master &&
81 test_commit "commit-new-file-F3" F3 3 &&
82 git config rerere.enabled true &&
83 test_must_fail git rebase -m master topic &&
t/t3419-rebase-patch-id.sh
+1 -1
@@ -39,7 +39,7 @@ run()
39 }
40
41 test_expect_success 'setup' '
42 - git commit --allow-empty -m initial
42 + git commit --allow-empty -m initial &&
43 git tag root
44 '
45