Permalink
Browse files

tests: add missing &&

Breaks in a test assertion's && chain can potentially hide
failures from earlier commands in the chain.

Commands intended to fail should be marked with !, test_must_fail, or
test_might_fail.  The examples in this patch do not require that.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information...
1 parent 00648ba commit a48fcd836971d065b9bf16b8cd046fd1aff9b279 @jrn jrn committed with gitster Oct 31, 2010
Showing with 166 additions and 166 deletions.
  1. +1 −1 t/annotate-tests.sh
  2. +1 −1 t/t0003-attributes.sh
  3. +2 −2 t/t0024-crlf-archive.sh
  4. +1 −1 t/t0026-eol-config.sh
  5. +6 −6 t/t0050-filesystem.sh
  6. +1 −1 t/t1000-read-tree-m-3way.sh
  7. +1 −1 t/t1001-read-tree-m-2way.sh
  8. +1 −1 t/t1011-read-tree-sparse-checkout.sh
  9. +1 −1 t/t1200-tutorial.sh
  10. +1 −1 t/t1302-repo-version.sh
  11. +1 −1 t/t1401-symbolic-ref.sh
  12. +2 −2 t/t1402-check-ref-format.sh
  13. +4 −4 t/t1410-reflog.sh
  14. +2 −2 t/t1450-fsck.sh
  15. +1 −1 t/t2007-checkout-symlink.sh
  16. +1 −1 t/t2016-checkout-patch.sh
  17. +1 −1 t/t2017-checkout-orphan.sh
  18. +2 −2 t/t2050-git-dir-relative.sh
  19. +1 −1 t/t2101-update-index-reupdate.sh
  20. +1 −1 t/t2200-add-update.sh
  21. +1 −1 t/t3001-ls-files-others-exclude.sh
  22. +1 −1 t/t3030-merge-recursive.sh
  23. +2 −2 t/t3050-subprojects-fetch.sh
  24. +3 −3 t/t3203-branch-output.sh
  25. +4 −4 t/t3300-funny-names.sh
  26. +1 −1 t/t3307-notes-man.sh
  27. +3 −3 t/t3406-rebase-message.sh
  28. +1 −1 t/t3408-rebase-multi-line.sh
  29. +2 −2 t/t3412-rebase-root.sh
  30. +3 −3 t/t3415-rebase-autosquash.sh
  31. +1 −1 t/t3417-rebase-whitespace-fix.sh
  32. +2 −2 t/t3504-cherry-pick-rerere.sh
  33. +3 −3 t/t3902-quoted.sh
  34. +3 −3 t/t3903-stash.sh
  35. +1 −1 t/t3904-stash-patch.sh
  36. +1 −1 t/t4008-diff-break-rewrite.sh
  37. +1 −1 t/t4015-diff-whitespace.sh
  38. +1 −1 t/t4021-format-patch-numbered.sh
  39. +4 −4 t/t4027-diff-submodule.sh
  40. +2 −2 t/t4034-diff-words.sh
  41. +4 −4 t/t4103-apply-binary.sh
  42. +2 −2 t/t4111-apply-subdir.sh
  43. +1 −1 t/t4119-apply-config.sh
  44. +9 −9 t/t4127-apply-same-fn.sh
  45. +1 −1 t/t4130-apply-criss-cross-rename.sh
  46. +4 −4 t/t4133-apply-filenames.sh
  47. +1 −1 t/t4134-apply-submodule.sh
  48. +1 −1 t/t4150-am.sh
  49. +1 −1 t/t4201-shortlog.sh
  50. +2 −2 t/t4202-log.sh
  51. +1 −1 t/t4252-am-options.sh
  52. +1 −1 t/t5300-pack-object.sh
  53. +2 −2 t/t5301-sliding-window.sh
  54. +1 −1 t/t5302-pack-index.sh
  55. +1 −1 t/t5500-fetch-pack.sh
  56. +1 −1 t/t5502-quickfetch.sh
  57. +1 −1 t/t5510-fetch.sh
  58. +1 −1 t/t5514-fetch-multiple.sh
  59. +4 −4 t/t5516-fetch-push.sh
  60. +1 −1 t/t5519-push-alternates.sh
  61. +1 −1 t/t5531-deep-submodule-push.sh
  62. +12 −12 t/t556x_common
  63. +4 −4 t/t6001-rev-list-graft.sh
  64. +1 −1 t/t6009-rev-list-parent.sh
  65. +1 −1 t/t6010-merge-base.sh
  66. +1 −1 t/t6024-recursive-merge.sh
  67. +1 −1 t/t6029-merge-subtree.sh
  68. +4 −4 t/t6030-bisect-porcelain.sh
  69. +1 −1 t/t6036-recursive-corner-cases.sh
  70. +1 −1 t/t6040-tracking-info.sh
  71. +1 −1 t/t6050-replace.sh
  72. +3 −3 t/t7105-reset-patch.sh
  73. +1 −1 t/t7509-commit.sh
  74. +1 −1 t/t7602-merge-octopus-many.sh
  75. +1 −1 t/t7610-mergetool.sh
  76. +2 −2 t/t7810-grep.sh
  77. +1 −1 t/t9104-git-svn-follow-parent.sh
  78. +1 −1 t/t9123-git-svn-rebuild-with-rewriteroot.sh
  79. +1 −1 t/t9124-git-svn-dcommit-auto-props.sh
  80. +11 −11 t/t9151-svn-mergeinfo.sh
  81. +1 −1 t/t9300-fast-import.sh
  82. +1 −1 t/t9350-fast-export.sh
  83. +1 −1 t/t9400-git-cvsserver-server.sh
  84. +1 −1 t/t9401-git-cvsserver-crlf.sh
View
@@ -38,7 +38,7 @@ test_expect_success \
'prepare reference tree' \
'echo "1A quick brown fox jumps over the" >file &&
echo "lazy dog" >>file &&
- git add file
+ git add file &&
GIT_AUTHOR_NAME="A" git commit -a -m "Initial."'
test_expect_success \
View
@@ -59,7 +59,7 @@ test_expect_success 'attribute test' '
test_expect_success 'attribute test: read paths from stdin' '
- cat <<EOF > expect
+ cat <<EOF > expect &&
f: test: f
a/f: test: f
a/c/f: test: f
View
@@ -7,7 +7,7 @@ UNZIP=${UNZIP:-unzip}
test_expect_success setup '
- git config core.autocrlf true
+ git config core.autocrlf true &&
printf "CRLF line ending\r\nAnd another\r\n" > sample &&
git add sample &&
@@ -20,7 +20,7 @@ test_expect_success setup '
test_expect_success 'tar archive' '
git archive --format=tar HEAD |
- ( mkdir untarred && cd untarred && "$TAR" -xf - )
+ ( mkdir untarred && cd untarred && "$TAR" -xf - ) &&
test_cmp sample untarred/sample
View
@@ -12,7 +12,7 @@ test_expect_success setup '
git config core.autocrlf false &&
- echo "one text" > .gitattributes
+ echo "one text" > .gitattributes &&
for w in Hello world how are you; do echo $w; done >one &&
for w in I am very very fine thank you; do echo $w; done >two &&
View
@@ -12,22 +12,22 @@ unibad=
no_symlinks=
test_expect_success 'see what we expect' '
- test_case=test_expect_success
- test_unicode=test_expect_success
+ test_case=test_expect_success &&
+ test_unicode=test_expect_success &&
mkdir junk &&
echo good >junk/CamelCase &&
echo bad >junk/camelcase &&
if test "$(cat junk/CamelCase)" != good
then
- test_case=test_expect_failure
+ test_case=test_expect_failure &&
case_insensitive=t
fi &&
rm -fr junk &&
mkdir junk &&
>junk/"$auml" &&
case "$(cd junk && echo *)" in
"$aumlcdiar")
- test_unicode=test_expect_failure
+ test_unicode=test_expect_failure &&
unibad=t
;;
*) ;;
@@ -36,7 +36,7 @@ test_expect_success 'see what we expect' '
{
ln -s x y 2> /dev/null &&
test -h y 2> /dev/null ||
- no_symlinks=1
+ no_symlinks=1 &&
rm -f y
}
'
@@ -128,7 +128,7 @@ test_expect_success "setup unicode normalization tests" '
cd unicode &&
touch "$aumlcdiar" &&
git add "$aumlcdiar" &&
- git commit -m initial
+ git commit -m initial &&
git tag initial &&
git checkout -b topic &&
git mv $aumlcdiar tmp &&
@@ -309,7 +309,7 @@ test_expect_success \
test_expect_success \
'6 - must not exist in O && !A && !B case' "
rm -f .git/index DD &&
- echo DD >DD
+ echo DD >DD &&
git update-index --add DD &&
test_must_fail git read-tree -m $tree_O $tree_A $tree_B
"
@@ -394,7 +394,7 @@ test_expect_success '-m references the correct modified tree' '
echo >file-a &&
echo >file-b &&
git add file-a file-b &&
- git commit -a -m "test for correct modified tree"
+ git commit -a -m "test for correct modified tree" &&
git branch initial-mod &&
echo b >file-b &&
git commit -a -m "B" &&
@@ -47,7 +47,7 @@ test_expect_success 'read-tree without .git/info/sparse-checkout' '
'
test_expect_success 'read-tree with .git/info/sparse-checkout but disabled' '
- echo >.git/info/sparse-checkout
+ echo >.git/info/sparse-checkout &&
git read-tree -m -u HEAD &&
git ls-files -t >result &&
test_cmp expected.swt result &&
View
@@ -42,7 +42,7 @@ test_expect_success 'git diff' '
'
test_expect_success 'tree' '
- tree=$(git write-tree 2>/dev/null)
+ tree=$(git write-tree 2>/dev/null) &&
test 8988da15d077d4829fc51d8544c097def6644dbb = $tree
'
View
@@ -39,7 +39,7 @@ test_expect_success 'gitdir selection on unsupported repo' '
(
cd test2 &&
git config core.repositoryformatversion >../actual
- )
+ ) &&
test_cmp expect actual
'
View
@@ -28,7 +28,7 @@ test_expect_success 'symbolic-ref refuses non-ref for HEAD' '
reset_to_sane
test_expect_success 'symbolic-ref refuses bare sha1' '
- echo content >file && git add file && git commit -m one
+ echo content >file && git add file && git commit -m one &&
test_must_fail git symbolic-ref HEAD `git rev-parse HEAD`
'
reset_to_sane
@@ -32,7 +32,7 @@ test_expect_success "check-ref-format --branch @{-1}" '
T=$(git write-tree) &&
sha1=$(echo A | git commit-tree $T) &&
git update-ref refs/heads/master $sha1 &&
- git update-ref refs/remotes/origin/master $sha1
+ git update-ref refs/remotes/origin/master $sha1 &&
git checkout master &&
git checkout origin/master &&
git checkout master &&
@@ -47,7 +47,7 @@ test_expect_success 'check-ref-format --branch from subdir' '
T=$(git write-tree) &&
sha1=$(echo A | git commit-tree $T) &&
git update-ref refs/heads/master $sha1 &&
- git update-ref refs/remotes/origin/master $sha1
+ git update-ref refs/remotes/origin/master $sha1 &&
git checkout master &&
git checkout origin/master &&
git checkout master &&
View
@@ -186,8 +186,8 @@ test_expect_success 'delete' '
test_tick &&
git commit -m tiger C &&
- HEAD_entry_count=$(git reflog | wc -l)
- master_entry_count=$(git reflog show master | wc -l)
+ HEAD_entry_count=$(git reflog | wc -l) &&
+ master_entry_count=$(git reflog show master | wc -l) &&
test $HEAD_entry_count = 5 &&
test $master_entry_count = 5 &&
@@ -199,13 +199,13 @@ test_expect_success 'delete' '
test $HEAD_entry_count = $(git reflog | wc -l) &&
! grep ox < output &&
- master_entry_count=$(wc -l < output)
+ master_entry_count=$(wc -l < output) &&
git reflog delete HEAD@{1} &&
test $(($HEAD_entry_count -1)) = $(git reflog | wc -l) &&
test $master_entry_count = $(git reflog show master | wc -l) &&
- HEAD_entry_count=$(git reflog | wc -l)
+ HEAD_entry_count=$(git reflog | wc -l) &&
git reflog delete master@{07.04.2005.15:15:00.-0700} &&
git reflog show master > output &&
View
@@ -61,7 +61,7 @@ test_expect_success 'object with bad sha1' '
sha=$(echo blob | git hash-object -w --stdin) &&
old=$(echo $sha | sed "s+^..+&/+") &&
new=$(dirname $old)/ffffffffffffffffffffffffffffffffffffff &&
- sha="$(dirname $new)$(basename $new)"
+ sha="$(dirname $new)$(basename $new)" &&
mv .git/objects/$old .git/objects/$new &&
test_when_finished "remove_object $sha" &&
git update-index --add --cacheinfo 100644 $sha foo &&
@@ -111,7 +111,7 @@ test_expect_success 'email with embedded > is not okay' '
'
test_expect_success 'tag pointing to nonexistent' '
- cat >invalid-tag <<-\EOF
+ cat >invalid-tag <<-\EOF &&
object ffffffffffffffffffffffffffffffffffffffff
type commit
tag invalid
@@ -17,7 +17,7 @@ test_expect_success SYMLINKS setup '
git branch side &&
echo goodbye >nitfol &&
- git add nitfol
+ git add nitfol &&
test_tick &&
git commit -m "master adds file nitfol" &&
@@ -32,7 +32,7 @@ test_expect_success PERL 'git checkout -p' '
'
test_expect_success PERL 'git checkout -p with staged changes' '
- set_state dir/foo work index
+ set_state dir/foo work index &&
(echo n; echo y) | git checkout -p &&
verify_saved_state bar &&
verify_state dir/foo index index
@@ -14,7 +14,7 @@ TEST_FILE=foo
test_expect_success 'Setup' '
echo "Initial" >"$TEST_FILE" &&
git add "$TEST_FILE" &&
- git commit -m "First Commit"
+ git commit -m "First Commit" &&
test_tick &&
echo "State 1" >>"$TEST_FILE" &&
git add "$TEST_FILE" &&
@@ -26,7 +26,7 @@ chmod +x .git/hooks/post-commit'
test_expect_success 'post-commit hook used ordinarily' '
echo initial >top &&
-git add top
+git add top &&
git commit -m initial &&
test -r "${COMMIT_FILE}"
'
@@ -45,7 +45,7 @@ test -r "${COMMIT_FILE}"
rm -rf "${COMMIT_FILE}"
test_expect_success 'post-commit-hook from sub dir' '
-echo changed again >top
+echo changed again >top &&
cd subdir &&
git --git-dir .git --work-tree .. add ../top &&
git --git-dir .git --work-tree .. commit -m subcommit &&
@@ -51,7 +51,7 @@ test_expect_success 'update-index again' \
echo hello world >dir1/file3 &&
echo goodbye people >file2 &&
git update-index --add file2 dir1/file3 &&
- echo hello everybody >file2
+ echo hello everybody >file2 &&
echo happy >dir1/file3 &&
git update-index --again &&
git ls-files -s >current &&
View
@@ -25,7 +25,7 @@ test_expect_success setup '
echo initial >dir1/sub2 &&
echo initial >dir2/sub3 &&
git add check dir1 dir2 top foo &&
- test_tick
+ test_tick &&
git commit -m initial &&
echo changed >check &&
@@ -156,7 +156,7 @@ test_expect_success 'trailing slash in exclude allows directory match (2)' '
test_expect_success 'trailing slash in exclude forces directory match (1)' '
- >two
+ >two &&
git ls-files --others --exclude=two/ >output &&
grep "^two" output
@@ -544,7 +544,7 @@ test_expect_success 'reset and bind merge' '
echo "100644 $o0 0 c"
echo "100644 $o1 0 d/e"
) >expected &&
- test_cmp expected actual
+ test_cmp expected actual &&
git read-tree --prefix=z/ master &&
git ls-files -s >actual &&
@@ -10,10 +10,10 @@ test_expect_success setup '
cd sub &&
git init &&
>subfile &&
- git add subfile
+ git add subfile &&
git commit -m "subproject commit #1"
) &&
- >mainfile
+ >mainfile &&
git add sub mainfile &&
test_tick &&
git commit -m "superproject commit #1"
View
@@ -12,13 +12,13 @@ test_expect_success 'make commits' '
'
test_expect_success 'make branches' '
- git branch branch-one
+ git branch branch-one &&
git branch branch-two HEAD^
'
test_expect_success 'make remote branches' '
- git update-ref refs/remotes/origin/branch-one branch-one
- git update-ref refs/remotes/origin/branch-two branch-two
+ git update-ref refs/remotes/origin/branch-one branch-one &&
+ git update-ref refs/remotes/origin/branch-two branch-two &&
git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/branch-one
'
View
@@ -43,8 +43,8 @@ test_expect_success TABS_IN_FILENAMES 'git ls-files no-funny' \
test_cmp expected current'
test_expect_success TABS_IN_FILENAMES 'setup expect' '
-t0=`git write-tree`
-echo "$t0" >t0
+t0=`git write-tree` &&
+echo "$t0" >t0 &&
cat > expected <<\EOF
just space
@@ -69,8 +69,8 @@ test_expect_success TABS_IN_FILENAMES 'git ls-files -z with-funny' \
test_cmp expected current'
test_expect_success TABS_IN_FILENAMES 'setup expect' '
-t1=`git write-tree`
-echo "$t1" >t1
+t1=`git write-tree` &&
+echo "$t1" >t1 &&
cat > expected <<\EOF
just space
View
@@ -26,7 +26,7 @@ test_expect_success 'example 1: notes to add an Acked-by line' '
'
test_expect_success 'example 2: binary notes' '
- cp "$TEST_DIRECTORY"/test4012.png .
+ cp "$TEST_DIRECTORY"/test4012.png . &&
git checkout B &&
blob=$(git hash-object -w test4012.png) &&
git notes --ref=logo add -C "$blob" &&
@@ -43,20 +43,20 @@ test_expect_success 'rebase -m' '
'
test_expect_success 'rebase --stat' '
- git reset --hard start
+ git reset --hard start &&
git rebase --stat master >diffstat.txt &&
grep "^ fileX | *1 +$" diffstat.txt
'
test_expect_success 'rebase w/config rebase.stat' '
- git reset --hard start
+ git reset --hard start &&
git config rebase.stat true &&
git rebase master >diffstat.txt &&
grep "^ fileX | *1 +$" diffstat.txt
'
test_expect_success 'rebase -n overrides config rebase.stat config' '
- git reset --hard start
+ git reset --hard start &&
git config rebase.stat true &&
git rebase -n master >diffstat.txt &&
! grep "^ fileX | *1 +$" diffstat.txt
@@ -16,7 +16,7 @@ test_expect_success setup '
git commit -a -m "A sample commit log message that has a long
summary that spills over multiple lines.
-But otherwise with a sane description."
+But otherwise with a sane description." &&
git branch side &&
View
@@ -173,14 +173,14 @@ EOF
test_expect_success 'pre-rebase hook stops rebase' '
git checkout -b stops1 other &&
test_must_fail git rebase --root --onto master &&
- test "z$(git symbolic-ref HEAD)" = zrefs/heads/stops1
+ test "z$(git symbolic-ref HEAD)" = zrefs/heads/stops1 &&
test 0 = $(git rev-list other...stops1 | wc -l)
'
test_expect_success 'pre-rebase hook stops rebase -i' '
git checkout -b stops2 other &&
test_must_fail git rebase --root --onto master &&
- test "z$(git symbolic-ref HEAD)" = zrefs/heads/stops2
+ test "z$(git symbolic-ref HEAD)" = zrefs/heads/stops2 &&
test 0 = $(git rev-list other...stops2 | wc -l)
'
Oops, something went wrong.

0 comments on commit a48fcd8

Please sign in to comment.