summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5a26973)
raw | patch | inline | side by side (parent: 5a26973)
author | Stephan Beyer <s-beyer@gmx.net> | |
Sat, 12 Jul 2008 15:47:52 +0000 (17:47 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 13 Jul 2008 20:21:26 +0000 (13:21 -0700) |
This patch changes every occurrence of "! git" -- with the meaning
that a git call has to gracefully fail -- into "test_must_fail git".
This is useful to
- make sure the test does not fail because of a signal,
e.g. SIGSEGV, and
- advertise the use of "test_must_fail" for new tests.
Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
that a git call has to gracefully fail -- into "test_must_fail git".
This is useful to
- make sure the test does not fail because of a signal,
e.g. SIGSEGV, and
- advertise the use of "test_must_fail" for new tests.
Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
58 files changed:
diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh
index d7cbc5c6dae538fe8c053a2f3760502422615e2c..70df15cbd8339b552a56a95ca0c0893138550201 100755 (executable)
--- a/t/t0000-basic.sh
+++ b/t/t0000-basic.sh
# updating a new file without --add should fail.
test_expect_success 'git update-index without --add should fail adding.' '
- ! git update-index should-be-empty
+ test_must_fail git update-index should-be-empty
'
# and with --add it should succeed, even if it is empty (it used to fail).
# Removing paths.
rm -f should-be-empty full-of-directories
test_expect_success 'git update-index without --remove should fail removing.' '
- ! git update-index should-be-empty
+ test_must_fail git update-index should-be-empty
'
test_expect_success \
'git update-index --index-info < badobjects'
test_expect_success 'writing this tree without --missing-ok.' '
- ! git write-tree
+ test_must_fail git write-tree
'
test_expect_success \
diff --git a/t/t0020-crlf.sh b/t/t0020-crlf.sh
index 2bfeac986eadeca0064b1aee808d08b2f86082c4..1be7446d8d9f8a46b463f2474a8c25bdd33044d2 100755 (executable)
--- a/t/t0020-crlf.sh
+++ b/t/t0020-crlf.sh
git config core.safecrlf true &&
for w in I am all CRLF; do echo $w; done | append_cr >allcrlf &&
- ! git add allcrlf
+ test_must_fail git add allcrlf
'
test_expect_success 'safecrlf: autocrlf=input, mixed LF/CRLF' '
git config core.safecrlf true &&
for w in Oh here is CRLFQ in text; do echo $w; done | q_to_cr >mixed &&
- ! git add mixed
+ test_must_fail git add mixed
'
test_expect_success 'safecrlf: autocrlf=true, all LF' '
git config core.safecrlf true &&
for w in I am all LF; do echo $w; done >alllf &&
- ! git add alllf
+ test_must_fail git add alllf
'
test_expect_success 'safecrlf: autocrlf=true mixed LF/CRLF' '
git config core.safecrlf true &&
for w in Oh here is CRLFQ in text; do echo $w; done | q_to_cr >mixed &&
- ! git add mixed
+ test_must_fail git add mixed
'
test_expect_success 'safecrlf: print warning only once' '
diff --git a/t/t0050-filesystem.sh b/t/t0050-filesystem.sh
index c5360e23d9ff1a5f31d42919eabdb2561f0d2e3d..b177174ef53e7689cc8c18b134afdbe90be72744 100755 (executable)
--- a/t/t0050-filesystem.sh
+++ b/t/t0050-filesystem.sh
else
test_expect_success "detection of case insensitive filesystem during repo init" '
- ! git config --bool core.ignorecase >/dev/null ||
+ test_must_fail git config --bool core.ignorecase >/dev/null ||
test $(git config --bool core.ignorecase) = false
'
fi
diff --git a/t/t1200-tutorial.sh b/t/t1200-tutorial.sh
index dcb3108c290813dae178394011bb2b44f2f7ca9e..09a8199335cbdf96f8aba75d47a321f0cfb828d9 100755 (executable)
--- a/t/t1200-tutorial.sh
+++ b/t/t1200-tutorial.sh
git commit -m 'Some fun.' -i hello example
test_expect_success 'git resolve now fails' '
- ! git merge -m "Merge work in mybranch" mybranch
+ test_must_fail git merge -m "Merge work in mybranch" mybranch
'
cat > hello << EOF
diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh
index afe7e663fb96484474f69af51268d42c78a04185..64567fb94d5c3f9587b643333212cdb37a4661ac 100755 (executable)
--- a/t/t1300-repo-config.sh
+++ b/t/t1300-repo-config.sh
'test wow = $(git config --get nextsection.nonewline !for)'
test_expect_success 'ambiguous get' '
- ! git config --get nextsection.nonewline
+ test_must_fail git config --get nextsection.nonewline
'
test_expect_success 'get multivar' \
test_expect_success 'multivar replace' 'cmp .git/config expect'
test_expect_success 'ambiguous value' '
- ! git config nextsection.nonewline
+ test_must_fail git config nextsection.nonewline
'
test_expect_success 'ambiguous unset' '
- ! git config --unset nextsection.nonewline
+ test_must_fail git config --unset nextsection.nonewline
'
test_expect_success 'invalid unset' '
- ! git config --unset somesection.nonewline
+ test_must_fail git config --unset somesection.nonewline
'
git config --unset nextsection.nonewline "wow3$"
test_expect_success 'multivar unset' 'cmp .git/config expect'
-test_expect_success 'invalid key' '! git config inval.2key blabla'
+test_expect_success 'invalid key' 'test_must_fail git config inval.2key blabla'
test_expect_success 'correct key' 'git config 123456.a123 987'
test_expect_success "rename succeeded" "test_cmp expect .git/config"
test_expect_success "rename non-existing section" '
- ! git config --rename-section branch."world domination" branch.drei
+ test_must_fail git config --rename-section \
+ branch."world domination" branch.drei
'
test_expect_success "rename succeeded" "test_cmp expect .git/config"
test_expect_success 'invalid bool (--get)' '
git config bool.nobool foobar &&
- ! git config --bool --get bool.nobool'
+ test_must_fail git config --bool --get bool.nobool'
test_expect_success 'invalid bool (set)' '
- ! git config --bool bool.nobool foobar'
+ test_must_fail git config --bool bool.nobool foobar'
rm .git/config
test_expect_success 'quoting' 'cmp .git/config expect'
test_expect_success 'key with newline' '
- ! git config "key.with
+ test_must_fail git config "key.with
newline" 123'
test_expect_success 'value with newline' 'git config key.sub value.with\\\
index 9be0770e7627ee094349af85b0d4702e156ff6cd..8d305b43725f8cf60e7ee802df1923feb98eeae5 100755 (executable)
--- a/t/t1302-repo-version.sh
+++ b/t/t1302-repo-version.sh
cd test && git apply --check --index ../test.patch)'
test_expect_success 'gitdir required mode on unsupported repo' '
- (cd test2 && ! git apply --check --index ../test.patch)
+ (cd test2 && test_must_fail git apply --check --index ../test.patch)
'
test_done
diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh
index ca99d37616aaaae9584ecfd1c5d74378c727d077..b31e4b1ac66e56d67ba48ab213c4ef9c32f05ea8 100755 (executable)
--- a/t/t1400-update-ref.sh
+++ b/t/t1400-update-ref.sh
rm -f .git/$m
test_expect_success '(not) create HEAD with old sha1' "
- ! git update-ref HEAD $A $B
+ test_must_fail git update-ref HEAD $A $B
"
test_expect_success "(not) prior created .git/$m" "
! test -f .git/$m
"create HEAD" \
"git update-ref HEAD $A"
test_expect_success '(not) change HEAD with wrong SHA1' "
- ! git update-ref HEAD $B $Z
+ test_must_fail git update-ref HEAD $B $Z
"
test_expect_success "(not) changed .git/$m" "
! test $B"' = $(cat .git/'"$m"')
index 5141fab7cf567fc5d16a8e9a296d2aff5f6c67e6..f7e1a735ec8699616280a086f59dc50c078bfaa7 100755 (executable)
test_expect_success \
'git checkout-index without -f should fail on conflicting work tree.' \
- '! git checkout-index -a'
+ 'test_must_fail git checkout-index -a'
test_expect_success \
'git checkout-index with -f should succeed.' \
index 9beaecd18b25cb7e22b09c11234c05a8fa1d4116..6ef2dcfd8afece86aaf6345630179af179eb2ed9 100755 (executable)
do
test_expect_success \
"git update-index to add conflicting path $p should fail." \
- "! git update-index --add -- $p"
+ "test_must_fail git update-index --add -- $p"
done
test_done
index f4da869932e40429f94d19a9cf2e18dc1e838f0a..af8c4121abfc28b7e289b39936df45bd5b82cf22 100755 (executable)
test_expect_success \
'git ls-files --error-unmatch should fail with unmatched path.' \
- '! git ls-files --error-unmatch foo bar-does-not-match'
+ 'test_must_fail git ls-files --error-unmatch foo bar-does-not-match'
test_expect_success \
'git ls-files --error-unmatch should succeed eith matched paths.' \
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index 8d8768688d8dde3637a50ece28fb8720b7612ddd..7c583c8055627d6f3c4a18bcce9c04005e0514d5 100755 (executable)
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
test_expect_success 'git branch -m o/o o should fail when o/p exists' '
git branch o/o &&
git branch o/p &&
- ! git branch -m o/o o
+ test_must_fail git branch -m o/o o
'
test_expect_success 'git branch -m q r/q should fail when r exists' '
git branch q &&
git branch r &&
- ! git branch -m q r/q
+ test_must_fail git branch -m q r/q
'
mv .git/config .git/config-saved
test_expect_success 'config information was renamed, too' \
"test $(git config branch.s.dummy) = Hello &&
- ! git config branch.s/s/dummy"
+ test_must_fail git config branch.s/s/dummy"
test_expect_success \
'git branch -m u v should fail when the reflog for u is a symlink' '
git branch -l u &&
mv .git/logs/refs/heads/u real-u &&
ln -s real-u .git/logs/refs/heads/u &&
- ! git branch -m u v
+ test_must_fail git branch -m u v
'
test_expect_success 'test tracking setup via --track' \
diff --git a/t/t3210-pack-refs.sh b/t/t3210-pack-refs.sh
index b64ccfbc5bcf40717f8e04bdadc841bc8cd6c51f..c2dec1c6320a0f9b555e3cd38d164c4e3efcb51e 100755 (executable)
--- a/t/t3210-pack-refs.sh
+++ b/t/t3210-pack-refs.sh
git branch c &&
git pack-refs --all &&
rm -f .git/refs/heads/c &&
- ! git branch c/d
+ test_must_fail git branch c/d
'
test_expect_success \
test_expect_success 'git branch i/j/k should barf if branch i exists' '
git branch i &&
git pack-refs --all --prune &&
- ! git branch i/j/k
+ test_must_fail git branch i/j/k
'
test_expect_success \
diff --git a/t/t3403-rebase-skip.sh b/t/t3403-rebase-skip.sh
index 0a26099658f4307f06fe594feb3fc046ff267076..0d33c71daa557e68268dfb2279a02fe2afca1ed7 100755 (executable)
--- a/t/t3403-rebase-skip.sh
+++ b/t/t3403-rebase-skip.sh
'
test_expect_success 'rebase with git am -3 (default)' '
- ! git rebase master
+ test_must_fail git rebase master
'
test_expect_success 'rebase --skip with am -3' '
test refs/heads/skip-reference = $(git symbolic-ref HEAD) &&
git branch post-rebase &&
git reset --hard pre-rebase &&
- ! git rebase master &&
+ test_must_fail git rebase master &&
echo "hello" > hello &&
git add hello &&
git rebase --continue &&
test_expect_success 'checkout skip-merge' 'git checkout -f skip-merge'
-test_expect_success 'rebase with --merge' '! git rebase --merge master'
+test_expect_success 'rebase with --merge' '
+ test_must_fail git rebase --merge master
+'
test_expect_success 'rebase --skip with --merge' '
git rebase --skip
index 7c92e261fcc87adc1a00c1832284816e40dee55d..0ab52da902c8d602e9c4d64660aa4a7e8e35544f 100755 (executable)
git reset --hard &&
git checkout a^0 &&
- ! git cherry-pick -m 1 b &&
+ test_must_fail git cherry-pick -m 1 b &&
git diff --exit-code a --
'
git reset --hard &&
git checkout a^0 &&
- ! git cherry-pick c &&
+ test_must_fail git cherry-pick c &&
git diff --exit-code a --
'
git reset --hard &&
git checkout b^0 &&
- ! git cherry-pick -m 3 c
+ test_must_fail git cherry-pick -m 3 c
'
git reset --hard &&
git checkout c^0 &&
- ! git revert -m 1 b &&
+ test_must_fail git revert -m 1 b &&
git diff --exit-code c
'
git reset --hard &&
git checkout c^0 &&
- ! git revert c &&
+ test_must_fail git revert c &&
git diff --exit-code c
'
git reset --hard &&
git checkout c^0 &&
- ! git revert -m 3 c &&
+ test_must_fail git revert -m 3 c &&
git diff --exit-code c
'
diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh
index f542f0af41989aee51f75b9844abf97943d9e33f..316775ecd96208c07f3211a24de2e5ec2ee409ab 100755 (executable)
--- a/t/t3600-rm.sh
+++ b/t/t3600-rm.sh
echo "other content" > foo
git add foo
echo "yet another content" > foo
- ! git rm --cached foo
+ test_must_fail git rm --cached foo
'
test_expect_success \
test_expect_success \
'Post-check that foo exists but is not in index after git rm foo' \
- '[ -f foo ] && ! git ls-files --error-unmatch foo'
+ '[ -f foo ] && test_must_fail git ls-files --error-unmatch foo'
test_expect_success \
'Pre-check that bar exists and is in index before "git rm bar"' \
test_expect_success \
'Post-check that bar does not exist and is not in index after "git rm -f bar"' \
- '! [ -f bar ] && ! git ls-files --error-unmatch bar'
+ '! [ -f bar ] && test_must_fail git ls-files --error-unmatch bar'
test_expect_success \
'Test that "git rm -- -q" succeeds (remove a file that looks like an option)' \
chmod a-w .
test_expect_success \
'Test that "git rm -f" fails if its rm fails' \
- '! git rm -f baz'
+ 'test_must_fail git rm -f baz'
chmod 775 .
else
test_expect_success 'skipping removal failure (perhaps running as root?)' :
test_expect_success 'Modify foo -- rm should refuse' '
echo >>foo &&
- ! git rm foo baz &&
+ test_must_fail git rm foo baz &&
test -f foo &&
test -f baz &&
git ls-files --error-unmatch foo baz
git rm -f foo baz &&
test ! -f foo &&
test ! -f baz &&
- ! git ls-files --error-unmatch foo &&
- ! git ls-files --error-unmatch bar
+ test_must_fail git ls-files --error-unmatch foo &&
+ test_must_fail git ls-files --error-unmatch bar
'
test_expect_success 'Re-add foo and baz for HEAD tests' '
'
test_expect_success 'foo is different in index from HEAD -- rm should refuse' '
- ! git rm foo baz &&
+ test_must_fail git rm foo baz &&
test -f foo &&
test -f baz &&
git ls-files --error-unmatch foo baz
git rm -f foo baz &&
test ! -f foo &&
test ! -f baz &&
- ! git ls-files --error-unmatch foo
- ! git ls-files --error-unmatch baz
+ test_must_fail git ls-files --error-unmatch foo
+ test_must_fail git ls-files --error-unmatch baz
'
test_expect_success 'Recursive test setup' '
'
test_expect_success 'Recursive without -r fails' '
- ! git rm frotz &&
+ test_must_fail git rm frotz &&
test -d frotz &&
test -f frotz/nitfol
'
test_expect_success 'Recursive with -r but dirty' '
echo qfwfq >>frotz/nitfol
- ! git rm -r frotz &&
+ test_must_fail git rm -r frotz &&
test -d frotz &&
test -f frotz/nitfol
'
'
test_expect_success 'Remove nonexistent file returns nonzero exit status' '
- ! git rm nonexistent
+ test_must_fail git rm nonexistent
'
test_done
diff --git a/t/t3700-add.sh b/t/t3700-add.sh
index e83fa1f6894dd13eb11cae6afb8ecbd3dcb999db..7d123d17fc156c61a8e85a399c3762e8075485de 100755 (executable)
--- a/t/t3700-add.sh
+++ b/t/t3700-add.sh
'
test_expect_success 'error out when attempting to add ignored ones without -f' '
- ! git add a.?? &&
+ test_must_fail git add a.?? &&
! (git ls-files | grep "\\.ig")
'
test_expect_success 'error out when attempting to add ignored ones without -f' '
- ! git add d.?? &&
+ test_must_fail git add d.?? &&
! (git ls-files | grep "\\.ig")
'
index 0922c708f16fea490a85d16d5d4d366df0fb2088..a27fccc8dce431169ce41f7137fb75f44149719c 100755 (executable)
test_expect_success 'check with trailing whitespace' '
echo "foo(); " > x &&
- ! git diff --check
+ test_must_fail git diff --check
'
# indent has space followed by hard tab
echo " foo();" > x &&
- ! git diff --check
+ test_must_fail git diff --check
'
echo "foo(); " > x &&
git add x &&
- ! git diff --cached --check
+ test_must_fail git diff --cached --check
'
# indent has space followed by hard tab
echo " foo();" > x &&
git add x &&
- ! git diff --cached --check
+ test_must_fail git diff --cached --check
'
echo "foo(); " > x &&
git add x &&
- ! git diff-index --check HEAD
+ test_must_fail git diff-index --check HEAD
'
# indent has space followed by hard tab
echo " foo();" > x &&
git add x &&
- ! git diff-index --check HEAD
+ test_must_fail git diff-index --check HEAD
'
echo "foo(); " > x &&
git add x &&
- ! git diff-index --cached --check HEAD
+ test_must_fail git diff-index --cached --check HEAD
'
# indent has space followed by hard tab
echo " foo();" > x &&
git add x &&
- ! git diff-index --cached --check HEAD
+ test_must_fail git diff-index --cached --check HEAD
'
echo "foo(); " > x &&
git commit -m "another commit" x &&
- ! git diff-tree --check HEAD^ HEAD
+ test_must_fail git diff-tree --check HEAD^ HEAD
'
# indent has space followed by hard tab
echo " foo();" > x &&
git commit -m "yet another" x &&
- ! git diff-tree --check HEAD^ HEAD
+ test_must_fail git diff-tree --check HEAD^ HEAD
'
git config core.whitespace "trailing-space" &&
echo "foo (); " > x &&
- ! git diff --check
+ test_must_fail git diff --check
'
# indent contains space followed by HT
git config core.whitespace "space-before-tab" &&
echo " foo (); " > x &&
- ! git diff --check
+ test_must_fail git diff --check
'
git config core.whitespace "indent-with-non-tab" &&
echo " foo ();" > x &&
- ! git diff --check
+ test_must_fail git diff --check
'
git config core.whitespace "indent-with-non-tab" &&
echo " foo ();" > x &&
- ! git diff --check
+ test_must_fail git diff --check
'
index 6d3ef6c60bd5a26e2ed4d533fc4db7711bb92cfb..833d6cbcfc063f336d97689ae4e547cf5e956b69 100755 (executable)
--- a/t/t4018-diff-funcname.sh
+++ b/t/t4018-diff-funcname.sh
test_expect_success 'last regexp must not be negated' '
git config diff.java.funcname "!static" &&
- ! git diff --no-index Beer.java Beer-correct.java
+ test_must_fail git diff --no-index Beer.java Beer-correct.java
'
test_done
index 1b58233da6cfa09092e6953f7d9c6bc38d7bae56..7da0b4bb8bfa96765b9f6eaa1693e2e24e82d335 100755 (executable)
--- a/t/t4103-apply-binary.sh
+++ b/t/t4103-apply-binary.sh
test_expect_success 'check binary diff -- should fail.' \
'git-checkout master &&
- ! git apply --check B.diff'
+ test_must_fail git apply --check B.diff'
test_expect_success 'check binary diff (copy) -- should fail.' \
'git-checkout master &&
- ! git apply --check C.diff'
+ test_must_fail git apply --check C.diff'
test_expect_success \
'check incomplete binary diff with replacement -- should fail.' '
git-checkout master &&
- ! git apply --check --allow-binary-replacement B.diff
+ test_must_fail git apply --check --allow-binary-replacement B.diff
'
test_expect_success \
'check incomplete binary diff with replacement (copy) -- should fail.' '
git-checkout master &&
- ! git apply --check --allow-binary-replacement C.diff
+ test_must_fail git apply --check --allow-binary-replacement C.diff
'
test_expect_success 'check binary diff with replacement.' \
test_expect_success 'apply binary diff -- should fail.' \
'do_reset &&
- ! git apply B.diff'
+ test_must_fail git apply B.diff'
test_expect_success 'apply binary diff -- should fail.' \
'do_reset &&
- ! git apply --index B.diff'
+ test_must_fail git apply --index B.diff'
test_expect_success 'apply binary diff (copy) -- should fail.' \
'do_reset &&
- ! git apply C.diff'
+ test_must_fail git apply C.diff'
test_expect_success 'apply binary diff (copy) -- should fail.' \
'do_reset &&
- ! git apply --index C.diff'
+ test_must_fail git apply --index C.diff'
test_expect_success 'apply binary diff without replacement.' \
'do_reset &&
index d74103988201b0c189e7a2564bfb0894e434c056..66fa51591eb7ee8f102fd86e30e54af2da3ea310 100755 (executable)
--- a/t/t4113-apply-ending.sh
+++ b/t/t4113-apply-ending.sh
# test
test_expect_success 'apply at the end' \
- '! git apply --index test-patch'
+ 'test_must_fail git apply --index test-patch'
cat >test-patch <<\EOF
diff a/file b/file
git update-index file
test_expect_success 'apply at the beginning' \
- '! git apply --index test-patch'
+ 'test_must_fail git apply --index test-patch'
test_done
diff --git a/t/t4150-am.sh b/t/t4150-am.sh
index bc982607d09bbdeb0d486eb282f5756a48ae5bcb..476f20b50a402f6843b4588d93d3acfdacf3603b 100755 (executable)
--- a/t/t4150-am.sh
+++ b/t/t4150-am.sh
test_expect_success 'am pauses on conflict' '
git checkout lorem2^^ &&
- ! git am lorem-move.patch &&
+ test_must_fail git am lorem-move.patch &&
test -d .dotest
'
test_expect_success 'am --resolved works' '
git checkout lorem2^^ &&
- ! git am lorem-move.patch &&
+ test_must_fail git am lorem-move.patch &&
test -d .dotest &&
echo resolved >>file &&
git add file &&
'
test_expect_success 'am fails on mail without patch' '
- ! git am <failmail &&
+ test_must_fail git am <failmail &&
rm -r .dotest/
'
test_expect_success 'am fails on empty patch' '
echo "---" >>failmail &&
- ! git am <failmail &&
+ test_must_fail git am <failmail &&
git am --skip &&
! test -d .dotest
'
diff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh
index a64727d5ad00cb222e3020b6702e4f89e212039c..746d61f8451d42b8a62d2e7afb9bde5256ff592b 100755 (executable)
--- a/t/t4200-rerere.sh
+++ b/t/t4200-rerere.sh
test_expect_success 'nothing recorded without rerere' '
(rm -rf .git/rr-cache; git config rerere.enabled false) &&
- ! git merge first &&
+ test_must_fail git merge first &&
! test -d .git/rr-cache
'
git reset --hard &&
mkdir .git/rr-cache &&
git config --unset rerere.enabled &&
- ! git merge first
+ test_must_fail git merge first
'
sha1=$(sed -e 's/ .*//' .git/rr-cache/MERGE_RR)
rm -rf .git/rr-cache &&
git config rerere.enabled true &&
git reset --hard &&
- ! git merge first &&
+ test_must_fail git merge first &&
grep ======= $rr/preimage
'
git checkout -b third master &&
git show second^:a1 | sed "s/To die: t/To die! T/" > a1 &&
git commit -q -a -m third &&
- ! git pull . first
+ test_must_fail git pull . first
'
git show first:a1 | sed 's/To die: t/To die! T/' > expect
echo Bello > file2 &&
git add file2 &&
git commit -m version2 &&
- ! git merge fourth &&
+ test_must_fail git merge fourth &&
sha1=$(sed -e "s/ .*//" .git/rr-cache/MERGE_RR) &&
rr=.git/rr-cache/$sha1 &&
echo Cello > file2 &&
diff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh
index 983a39398f17dc2b261771e780e8c010f038a12a..645583f9d729cb04ea7bd9638b0c49c48128822e 100755 (executable)
--- a/t/t5300-pack-object.sh
+++ b/t/t5300-pack-object.sh
test_expect_success \
'make sure index-pack detects the SHA1 collision' \
- '! git-index-pack -o bad.idx test-3.pack'
+ 'test_must_fail git-index-pack -o bad.idx test-3.pack'
test_expect_success \
'honor pack.packSizeLimit' \
diff --git a/t/t5302-pack-index.sh b/t/t5302-pack-index.sh
index ecec5916346ce76936a807ebc769c3981fc0bf8c..0639772ac4e1e2c6563e793b16c2c10faf06758a 100755 (executable)
--- a/t/t5302-pack-index.sh
+++ b/t/t5302-pack-index.sh
test_expect_success \
'[index v1] 4) confirm that the pack is actually corrupted' \
- '! git fsck --full $commit'
+ 'test_must_fail git fsck --full $commit'
test_expect_success \
'[index v1] 5) pack-objects happily reuses corrupted data' \
test_expect_success \
'[index v1] 6) newly created pack is BAD !' \
- '! git verify-pack -v "test-4-${pack1}.pack"'
+ 'test_must_fail git verify-pack -v "test-4-${pack1}.pack"'
test_expect_success \
'[index v2] 1) stream pack to repository' \
test_expect_success \
'[index v2] 4) confirm that the pack is actually corrupted' \
- '! git fsck --full $commit'
+ 'test_must_fail git fsck --full $commit'
test_expect_success \
'[index v2] 5) pack-objects refuses to reuse corrupted data' \
- '! git pack-objects test-5 <obj-list'
+ 'test_must_fail git pack-objects test-5 <obj-list'
test_expect_success \
'[index v2] 6) verify-pack detects CRC mismatch' \
( while read obj
do git cat-file -p $obj >/dev/null || exit 1
done <obj-list ) &&
- err=$(! git verify-pack ".git/objects/pack/pack-${pack1}.pack" 2>&1) &&
+ err=$(test_must_fail git verify-pack \
+ ".git/objects/pack/pack-${pack1}.pack" 2>&1) &&
echo "$err" | grep "CRC mismatch"'
test_done
index 2fff3001530bdf3e6acc283042d432a0698cea03..ee769d6695ee91120671c485924d804f14c80424 100755 (executable)
--- a/t/t5401-update-hooks.sh
+++ b/t/t5401-update-hooks.sh
chmod u+x victim/.git/hooks/post-update
test_expect_success push '
- ! git-send-pack --force ./victim/.git master tofail >send.out 2>send.err
+ test_must_fail git-send-pack --force ./victim/.git \
+ master tofail >send.out 2>send.err
'
test_expect_success 'updated as expected' '
index 64fe2615acbd3368536b8a79c0b707561b3e16bd..c24003565d635722f07333bb662c8e102d577c9e 100755 (executable)
git commit -a -m aa-master
'
-test_expect_success 'mixed-success push returns error' '! git push'
+test_expect_success 'mixed-success push returns error' '
+ test_must_fail git push
+'
test_expect_success 'check tracking branches updated correctly after push' '
test "$(git rev-parse origin/master)" = "$(git rev-parse master)"
index 46b2cb4e46d9d8bb2ae8cf2ea5d6b03331d4ac05..59e80a5ea253607bf83ac4eed670744df950eb81 100755 (executable)
git commit -a -m 2
'
-test_expect_success 'push reports error' '! git push 2>stderr'
+test_expect_success 'push reports error' 'test_must_fail git push 2>stderr'
test_expect_success 'individual ref reports error' 'grep rejected stderr'
diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh
index 140e8745811b9f25abfa2c9c24a0569f8dd39c66..362cf7e928090fb3752936317f78a4d128810127 100755 (executable)
--- a/t/t5500-fetch-pack.sh
+++ b/t/t5500-fetch-pack.sh
"test \"count: 18\" = \"$(grep count count.shallow)\""
test_expect_success "pull in shallow repo with missing merge base" \
- "(cd shallow && ! git pull --depth 4 .. A)"
+ "(cd shallow && test_must_fail git pull --depth 4 .. A)"
test_done
diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh
index 1e192a2207a4b56d477e8e3efc382c3a296ba776..be9ee9326fc4590dcc875e31b6cf64b800451bc5 100755 (executable)
--- a/t/t5505-remote.sh
+++ b/t/t5505-remote.sh
git fetch origin &&
git remote prune origin &&
git rev-parse refs/remotes/origin/side2 &&
- ! git rev-parse refs/remotes/origin/side)
+ test_must_fail git rev-parse refs/remotes/origin/side)
'
cat > test/expect << EOF
(cd test &&
git remote prune --dry-run origin > output &&
git rev-parse refs/remotes/origin/side2 &&
- ! git rev-parse refs/remotes/origin/side &&
+ test_must_fail git rev-parse refs/remotes/origin/side &&
(cd ../one &&
git branch -m side side2) &&
test_cmp expect output)
git branch -m side2 side) &&
(cd mirror &&
git rev-parse --verify refs/heads/side2 &&
- ! git rev-parse --verify refs/heads/side &&
+ test_must_fail git rev-parse --verify refs/heads/side &&
git fetch origin &&
git remote prune origin &&
- ! git rev-parse --verify refs/heads/side2 &&
+ test_must_fail git rev-parse --verify refs/heads/side2 &&
git rev-parse --verify refs/heads/side)
'
git branch -m side side2) &&
(cd alttst &&
git rev-parse --verify refs/remotes/origin/side &&
- ! git rev-parse --verify refs/remotes/origin/side2 &&
+ test_must_fail git rev-parse --verify refs/remotes/origin/side2 &&
git fetch alt &&
git remote prune alt &&
- ! git rev-parse --verify refs/remotes/origin/side &&
+ test_must_fail git rev-parse --verify refs/remotes/origin/side &&
git rev-parse --verify refs/remotes/origin/side2)
'
test_expect_success 'reject adding remote with an invalid name' '
- ! git remote add some:url desired-name
+ test_must_fail git remote add some:url desired-name
'
diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh
index df7750f7d1ede6e888ec3071397115022e067eb3..13d1d826c20293c26c739c70c0a36ed48bbb41d1 100755 (executable)
--- a/t/t5510-fetch.sh
+++ b/t/t5510-fetch.sh
cd five &&
git init &&
- ! git fetch .. anno:five
+ test_must_fail git fetch .. anno:five
'
cd six &&
git init &&
- ! git fetch .. six:six
+ test_must_fail git fetch .. six:six
'
test_expect_success 'unbundle 1' '
cd "$D/bundle" &&
git checkout -b some-branch &&
- ! git fetch "$D/bundle1" master:master
+ test_must_fail git fetch "$D/bundle1" master:master
'
test_expect_success 'bundle 1 has only 3 files ' '
# the strange name is: a\!'b
test_expect_success 'quoting of a strangely named repo' '
- ! git fetch "a\\!'\''b" > result 2>&1 &&
+ test_must_fail git fetch "a\\!'\''b" > result 2>&1 &&
cat result &&
grep "fatal: '\''a\\\\!'\''b'\''" result
'
git fetch origin master &&
n=$(git rev-parse --verify refs/remotes/origin/master) &&
test "$o" = "$n" &&
- ! git rev-parse --verify refs/remotes/origin/side
+ test_must_fail git rev-parse --verify refs/remotes/origin/side
)
'
git pull origin master &&
n=$(git rev-parse --verify refs/remotes/origin/master) &&
test "$o" = "$n" &&
- ! git rev-parse --verify refs/remotes/origin/side
+ test_must_fail git rev-parse --verify refs/remotes/origin/side
)
'
diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
index 6805032a05cba00536f8d0621873741773a49f92..f0030ad00e4a6478fcb3ccfc503e576bd58003bd 100755 (executable)
--- a/t/t5516-fetch-push.sh
+++ b/t/t5516-fetch-push.sh
mk_test heads/master &&
git push testrepo : &&
git commit --amend -massaged &&
- ! git push testrepo &&
+ test_must_fail git push testrepo &&
check_push_result $the_commit heads/master &&
git reset --hard $the_commit
# Without force rewinding should fail
git reset --hard HEAD^ &&
- ! git push testrepo HEAD &&
+ test_must_fail git push testrepo HEAD &&
check_push_result $the_commit heads/local &&
# With force rewinding should succeed
git clone parent child &&
(cd child &&
echo two >foo && git commit -a -m two &&
- ! git push &&
+ test_must_fail git push &&
test $(git rev-parse master) != \
$(git rev-parse remotes/origin/master))
pwd &&
rm -f testrepo/.git/objects/??/* &&
git push testrepo :refs/heads/master &&
- (cd testrepo && ! git rev-parse --verify refs/heads/master)
+ (cd testrepo && test_must_fail git rev-parse --verify refs/heads/master)
'
index 8b0509106951c5ddf2995862bc2a3887c963bfe6..1a15817cd5f8e838812723ad14dbec59a108680c 100755 (executable)
'
test_expect_success 'fsck fails' '
- ! git fsck
+ test_must_fail git fsck
'
test_expect_success 'upload-pack fails due to error in pack-objects' '
'
test_expect_success 'fsck fails' '
- ! git fsck
+ test_must_fail git fsck
'
test_expect_success 'upload-pack fails due to error in rev-list' '
test_expect_success 'fetch fails' '
- ! git fetch .. master
+ test_must_fail git fetch .. master
'
diff --git a/t/t5540-http-push.sh b/t/t5540-http-push.sh
index 21dbb557b7cfad412ba1796519a7a63a403c35bb..f8c17cd96cc86ca8f2db2ff51467f712d65f8956 100755 (executable)
--- a/t/t5540-http-push.sh
+++ b/t/t5540-http-push.sh
git push origin :dev &&
git branch -d -r origin/dev &&
git fetch &&
- ! git show-ref --verify refs/remotes/origin/dev
+ test_must_fail git show-ref --verify refs/remotes/origin/dev
'
stop_httpd
index acf34cec8f0ce5930f48a6e31ef84b8843097d74..3c013e2b6aa5c659c80134baf43c99e0d89e2e38 100755 (executable)
test_expect_success \
'clone of non-existent source should fail' \
- '! git-clone foo bar'
+ 'test_must_fail git-clone foo bar'
test_expect_success \
'failed clone should not leave a directory' \
# current path not to the target dir
test_expect_success \
'clone of non-existent (relative to $PWD) source should fail' \
- '! git-clone ../foo baz'
+ 'test_must_fail git-clone ../foo baz'
test_expect_success \
'clone should work now that source exists' \
diff --git a/t/t6023-merge-file.sh b/t/t6023-merge-file.sh
index 74e9e6618e5b104c6d7e0731fd2772c0b95eefab..f674c48cab3e80d63b5a5831c667b8e08b542905 100755 (executable)
--- a/t/t6023-merge-file.sh
+++ b/t/t6023-merge-file.sh
cp test.txt backup.txt
test_expect_success "merge with conflicts" \
- "! git merge-file test.txt orig.txt new3.txt"
+ "test_must_fail git merge-file test.txt orig.txt new3.txt"
cat > expect.txt << EOF
<<<<<<< test.txt
cp backup.txt test.txt
test_expect_success "merge with conflicts, using -L" \
- "! git merge-file -L 1 -L 2 test.txt orig.txt new3.txt"
+ "test_must_fail git merge-file -L 1 -L 2 test.txt orig.txt new3.txt"
cat > expect.txt << EOF
<<<<<<< 1
sed "s/ tu / TU /" < new1.txt > new5.txt
test_expect_success "conflict in removed tail" \
- "! git merge-file -p orig.txt new1.txt new5.txt > out"
+ "test_must_fail git merge-file -p orig.txt new1.txt new5.txt > out"
cat > expect << EOF
Dominus regit me,
test_expect_success "expected conflict markers" "test_cmp expect out"
test_expect_success 'binary files cannot be merged' '
- ! git merge-file -p orig.txt ../test4012.png new1.txt 2> merge.err &&
+ test_must_fail git merge-file -p \
+ orig.txt ../test4012.png new1.txt 2> merge.err &&
grep "Cannot merge binary files" merge.err
'
test_expect_success 'MERGE_ZEALOUS simplifies non-conflicts' '
- ! git merge-file -p new6.txt new5.txt new7.txt > output &&
+ test_must_fail git merge-file -p new6.txt new5.txt new7.txt > output &&
test 1 = $(grep ======= < output | wc -l)
'
test_expect_success 'ZEALOUS_ALNUM' '
- ! git merge-file -p new8.txt new5.txt new9.txt > merge.out &&
+ test_must_fail git merge-file -p \
+ new8.txt new5.txt new9.txt > merge.out &&
test 1 = $(grep ======= < merge.out | wc -l)
'
index 6a6a13002d3dc66c043a43df910a79940b178da4..802d0d06ebddec9db6e3a109e689b3974f1e0ff1 100755 (executable)
GIT_AUTHOR_DATE="2006-12-12 23:00:08" git commit -m F
'
-test_expect_success "combined merge conflicts" "! git merge -m final G"
+test_expect_success "combined merge conflicts" "
+ test_must_fail git merge -m final G
+"
cat > expect << EOF
<<<<<<< HEAD:a1
printf "\0\0" > binary-file &&
git add binary-file &&
git commit -m binary2 &&
- ! git merge F > merge.out 2> merge.err &&
+ test_must_fail git merge F > merge.out 2> merge.err &&
grep "Cannot merge binary files: HEAD:binary-file vs. F:binary-file" \
merge.err
'
index 6004deb43228836f61e0c4b8762a2511a2c1780a..fc58456a11eef7ecb4cf60d37a9e9d5cbe13f970 100755 (executable)
test_expect_success \
'merge master into b-symlink, which has a different symbolic link' '
git-checkout b-symlink &&
-! git-merge master'
+test_must_fail git-merge master'
test_expect_success \
'the merge result must be a file' '
test_expect_success \
'merge master into b-file, which has a file instead of a symbolic link' '
git-reset --hard && git-checkout b-file &&
-! git-merge master'
+test_must_fail git-merge master'
test_expect_success \
'the merge result must be a file' '
'merge b-file, which has a file instead of a symbolic link, into master' '
git-reset --hard &&
git-checkout master &&
-! git-merge b-file'
+test_must_fail git-merge b-file'
test_expect_success \
'the merge result must be a file' '
index 2328b699474cbe338def30179b07f25fa7fa357a..efc831363e7bfa2b38353f22ada751fd7db35a3e 100755 (executable)
test_expect_success 'final^1^2' "test $(git rev-parse start2) = $(git rev-parse final^1^2)"
test_expect_success 'final^1^2 != final^1^1' "test $(git rev-parse final^1^2) != $(git rev-parse final^1^1)"
test_expect_success 'final^1^3 not valid' "if git rev-parse --verify final^1^3; then false; else :; fi"
-test_expect_success '--verify start2^1' '! git rev-parse --verify start2^1'
+test_expect_success '--verify start2^1' 'test_must_fail git rev-parse --verify start2^1'
test_expect_success '--verify start2^0' 'git rev-parse --verify start2^0'
test_expect_success 'repack for next test' 'git repack -a -d'
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index fa382c58da08a6eeca1aa51d4af47215e3e1c107..336cfaa1c5f1b6dd8a4189ee784e35a0651d52b5 100755 (executable)
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
test_expect_success \
'do not move directory over existing directory' \
- 'mkdir path0 && mkdir path0/path2 && ! git mv path2 path0'
+ 'mkdir path0 && mkdir path0/path2 && test_must_fail git mv path2 path0'
test_expect_success \
'move into "."' \
>sub/file &&
git add sub/file &&
- ! git mv sub "$out/out" &&
+ test_must_fail git mv sub "$out/out" &&
test -d sub &&
! test -d ../in &&
git ls-files --error-unmatch sub/file
diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh
index 241c70dc66f71d9f53ddc6637e2f813020e740d6..bc7ce2cbbb712f890245688da03be96146a1d9ed 100755 (executable)
--- a/t/t7004-tag.sh
+++ b/t/t7004-tag.sh
'! (tag_exists mytag)'
test_expect_success 'creating a tag in an empty tree should fail' '
- ! git-tag mynotag &&
+ test_must_fail git-tag mynotag &&
! tag_exists mynotag
'
test_expect_success 'creating a tag for HEAD in an empty tree should fail' '
- ! git-tag mytaghead HEAD &&
+ test_must_fail git-tag mytaghead HEAD &&
! tag_exists mytaghead
'
test_expect_success 'creating a tag for an unknown revision should fail' '
- ! git-tag mytagnorev aaaaaaaaaaa &&
+ test_must_fail git-tag mytagnorev aaaaaaaaaaa &&
! tag_exists mytagnorev
'
test_expect_success \
'trying to create a tag with the name of one existing should fail' \
- '! git tag mytag'
+ 'test_must_fail git tag mytag'
test_expect_success \
'trying to create a tag with a non-valid name should fail' '
test `git-tag -l | wc -l` -eq 1 &&
- ! git tag "" &&
- ! git tag .othertag &&
- ! git tag "other tag" &&
- ! git tag "othertag^" &&
- ! git tag "other~tag" &&
+ test_must_fail git tag "" &&
+ test_must_fail git tag .othertag &&
+ test_must_fail git tag "other tag" &&
+ test_must_fail git tag "othertag^" &&
+ test_must_fail git tag "other~tag" &&
test `git-tag -l | wc -l` -eq 1
'
test_expect_success 'trying to delete an unknown tag should fail' '
! tag_exists unknown-tag &&
- ! git-tag -d unknown-tag
+ test_must_fail git-tag -d unknown-tag
'
cat >expect <<EOF
'trying to delete two tags, existing and not, should fail in the 2nd' '
tag_exists mytag &&
! tag_exists myhead &&
- ! git-tag -d mytag anothertag &&
+ test_must_fail git-tag -d mytag anothertag &&
! tag_exists mytag &&
! tag_exists myhead
'
test_expect_success 'trying to delete an already deleted tag should fail' \
- '! git-tag -d mytag'
+ 'test_must_fail git-tag -d mytag'
# listing various tags with pattern matching:
'
test_expect_success 'trying to verify an unknown tag should fail' \
- '! git-tag -v unknown-tag'
+ 'test_must_fail git-tag -v unknown-tag'
test_expect_success \
'trying to verify a non-annotated and non-signed tag should fail' \
- '! git-tag -v non-annotated-tag'
+ 'test_must_fail git-tag -v non-annotated-tag'
test_expect_success \
'trying to verify many non-annotated or unknown tags, should fail' \
- '! git-tag -v unknown-tag1 non-annotated-tag unknown-tag2'
+ 'test_must_fail git-tag -v unknown-tag1 non-annotated-tag unknown-tag2'
# creating annotated tags:
'trying to create a tag with a non-existing -F file should fail' '
! test -f nonexistingfile &&
! tag_exists notag &&
- ! git-tag -F nonexistingfile notag &&
+ test_must_fail git-tag -F nonexistingfile notag &&
! tag_exists notag
'
echo "message file 1" >msgfile1 &&
echo "message file 2" >msgfile2 &&
! tag_exists msgtag &&
- ! git-tag -m "message 1" -F msgfile1 msgtag &&
+ test_must_fail git-tag -m "message 1" -F msgfile1 msgtag &&
! tag_exists msgtag &&
- ! git-tag -F msgfile1 -m "message 1" msgtag &&
+ test_must_fail git-tag -F msgfile1 -m "message 1" msgtag &&
! tag_exists msgtag &&
- ! git-tag -m "message 1" -F msgfile1 -m "message 2" msgtag &&
+ test_must_fail git-tag -m "message 1" -F msgfile1 \
+ -m "message 2" msgtag &&
! tag_exists msgtag
'
test_expect_success \
'trying to verify an annotated non-signed tag should fail' '
tag_exists annotated-tag &&
- ! git-tag -v annotated-tag
+ test_must_fail git-tag -v annotated-tag
'
test_expect_success \
'trying to verify a file-annotated non-signed tag should fail' '
tag_exists file-annotated-tag &&
- ! git-tag -v file-annotated-tag
+ test_must_fail git-tag -v file-annotated-tag
'
test_expect_success \
'trying to verify two annotated non-signed tags should fail' '
tag_exists annotated-tag file-annotated-tag &&
- ! git-tag -v annotated-tag file-annotated-tag
+ test_must_fail git-tag -v annotated-tag file-annotated-tag
'
# creating and verifying signed tags:
test_expect_success 'sign with an unknown id (1)' '
- ! git tag -u author@example.com -m "Another message" o-signed-tag
+ test_must_fail git tag -u author@example.com \
+ -m "Another message" o-signed-tag
'
test_expect_success 'sign with an unknown id (2)' '
- ! git tag -u DEADBEEF -m "Another message" o-signed-tag
+ test_must_fail git tag -u DEADBEEF -m "Another message" o-signed-tag
'
'trying to create a signed tag with non-existing -F file should fail' '
! test -f nonexistingfile &&
! tag_exists nosigtag &&
- ! git-tag -s -F nonexistingfile nosigtag &&
+ test_must_fail git-tag -s -F nonexistingfile nosigtag &&
! tag_exists nosigtag
'
@@ -730,10 +732,11 @@ test_expect_success 'verifying two signed tags in one command should succeed' \
test_expect_success \
'verifying many signed and non-signed tags should fail' '
- ! git-tag -v signed-tag annotated-tag &&
- ! git-tag -v file-annotated-tag file-signed-tag &&
- ! git-tag -v annotated-tag file-signed-tag file-annotated-tag &&
- ! git-tag -v signed-tag annotated-tag file-signed-tag
+ test_must_fail git-tag -v signed-tag annotated-tag &&
+ test_must_fail git-tag -v file-annotated-tag file-signed-tag &&
+ test_must_fail git-tag -v annotated-tag \
+ file-signed-tag file-annotated-tag &&
+ test_must_fail git-tag -v signed-tag annotated-tag file-signed-tag
'
test_expect_success 'verifying a forged tag should fail' '
sed -e "s/signed-tag/forged-tag/" |
git mktag) &&
git tag forged-tag $forged &&
- ! git-tag -v forged-tag
+ test_must_fail git-tag -v forged-tag
'
# blank and empty messages for signed tags:
git config user.signingkey BobTheMouse
test_expect_success \
'git-tag -s fails if gpg is misconfigured' \
- '! git tag -s -m tail tag-gpg-failure'
+ 'test_must_fail git tag -s -m tail tag-gpg-failure'
git config --unset user.signingkey
# try to verify without gpg:
rm -rf gpghome
test_expect_success \
'verify signed tag fails when public key is not present' \
- '! git-tag -v signed-tag'
+ 'test_must_fail git-tag -v signed-tag'
test_expect_success \
'git-tag -a fails if tag annotation is empty' '
diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh
index 96d15083fb5ac540a0825b8c00dc43c8843a6dec..0bfc1e9be49110ac0e8130fcdef440eecbaff2c9 100755 (executable)
--- a/t/t7102-reset.sh
+++ b/t/t7102-reset.sh
EOF
test_expect_success 'giving a non existing revision should fail' '
- ! git reset aaaaaa &&
- ! git reset --mixed aaaaaa &&
- ! git reset --soft aaaaaa &&
- ! git reset --hard aaaaaa &&
+ test_must_fail git reset aaaaaa &&
+ test_must_fail git reset --mixed aaaaaa &&
+ test_must_fail git reset --soft aaaaaa &&
+ test_must_fail git reset --hard aaaaaa &&
check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc
'
touch .git/MERGE_HEAD &&
echo "100644 44c5b5884550c17758737edcced463447b91d42b 1 un" |
git update-index --index-info &&
- ! git reset --soft HEAD &&
+ test_must_fail git reset --soft HEAD &&
rm .git/MERGE_HEAD &&
git rm --cached -- un
'
test_expect_success \
'giving paths with options different than --mixed should fail' '
- ! git reset --soft -- first &&
- ! git reset --hard -- first &&
- ! git reset --soft HEAD^ -- first &&
- ! git reset --hard HEAD^ -- first &&
+ test_must_fail git reset --soft -- first &&
+ test_must_fail git reset --hard -- first &&
+ test_must_fail git reset --soft HEAD^ -- first &&
+ test_must_fail git reset --hard HEAD^ -- first &&
check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc
'
test_expect_success 'giving unrecognized options should fail' '
- ! git reset --other &&
- ! git reset -o &&
- ! git reset --mixed --other &&
- ! git reset --mixed -o &&
- ! git reset --soft --other &&
- ! git reset --soft -o &&
- ! git reset --hard --other &&
- ! git reset --hard -o &&
+ test_must_fail git reset --other &&
+ test_must_fail git reset -o &&
+ test_must_fail git reset --mixed --other &&
+ test_must_fail git reset --mixed -o &&
+ test_must_fail git reset --soft --other &&
+ test_must_fail git reset --soft -o &&
+ test_must_fail git reset --hard --other &&
+ test_must_fail git reset --hard -o &&
check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc
'
echo "3rd line in branch2" >>secondfile &&
git commit -a -m "change in branch2" &&
- ! git merge branch1 &&
- ! git reset --soft &&
+ test_must_fail git merge branch1 &&
+ test_must_fail git reset --soft &&
printf "1st line 2nd file\n2nd line 2nd file\n3rd line" >secondfile &&
git commit -a -m "the change in branch2" &&
echo "3rd line in branch4" >>secondfile &&
git checkout -m branch3 &&
- ! git reset --soft &&
+ test_must_fail git reset --soft &&
printf "1st line 2nd file\n2nd line 2nd file\n3rd line" >secondfile &&
git commit -a -m "the line in branch3" &&
echo "3rd line in branch2" >>secondfile &&
git commit -a -m "change in branch2" &&
- ! git pull . branch1 &&
+ test_must_fail git pull . branch1 &&
git reset --hard &&
check_changes 77abb337073fb4369a7ad69ff6f5ec0e4d6b54bb
'
echo 4 > file4 &&
echo 5 > file1 &&
git add file1 file3 file4 &&
- ! git reset HEAD -- file1 file2 file3 &&
+ test_must_fail git reset HEAD -- file1 file2 file3 &&
git diff > output &&
test_cmp output expect &&
git diff --cached > output &&
>sub/file2 &&
git update-index --add sub/file1 sub/file2 &&
T=$(git write-tree) &&
- ! git reset HEAD sub/file2 &&
+ test_must_fail git reset HEAD sub/file2 &&
U=$(git write-tree) &&
echo "$T" &&
echo "$U" &&
- ! git diff-index --cached --exit-code "$T" &&
+ test_must_fail git diff-index --cached --exit-code "$T" &&
test "$T" != "$U"
'
diff --git a/t/t7103-reset-bare.sh b/t/t7103-reset-bare.sh
index b25a77f910fcdd589775ce901bdf878c23677dd4..cdecebe456c7a9cf30465b112a24ce7bcf76f344 100755 (executable)
--- a/t/t7103-reset-bare.sh
+++ b/t/t7103-reset-bare.sh
'
test_expect_success 'hard reset is not allowed' '
- ! git reset --hard HEAD^
+ test_must_fail git reset --hard HEAD^
'
test_expect_success 'soft reset is allowed' '
diff --git a/t/t7300-clean.sh b/t/t7300-clean.sh
index bd7723970869aa0ce8f48b83fdc568821fdf737c..2b51c0d7d8ab727a5fb0be8338938f1d3b2eb6a3 100755 (executable)
--- a/t/t7300-clean.sh
+++ b/t/t7300-clean.sh
test_expect_success 'clean.requireForce defaults to true' '
git config --unset clean.requireForce &&
- ! git-clean
+ test_must_fail git clean
'
test_expect_success 'clean.requireForce' '
git config clean.requireForce true &&
- ! git-clean
+ test_must_fail git clean
'
index 6c7b9024822024ca24f7d1ddea63c94d3aa016b0..cbc0c34ce2487959ef0e8f89f7c2a5d4a68be826 100755 (executable)
then
echo "[OOPS] init succeeded but submodule url is wrong"
false
- elif ! git config submodule.example.url ./.subrepo
+ elif test_must_fail git config submodule.example.url ./.subrepo
then
echo "[OOPS] init succeeded but update of url failed"
false
index 5becb3ec5481b2407a18e59a426241be8f684051..f919c8d34de41b2ec3fe08c217dd2c6276cf8472 100755 (executable)
test_tick &&
git commit -m rewrite file &&
echo dirty > file &&
- ! git rebase --onto HEAD~2 HEAD^
+ test_must_fail git rebase --onto HEAD~2 HEAD^
'
diff --git a/t/t7500-commit.sh b/t/t7500-commit.sh
index baed6ce96beb260a32e027dd573313c82202ea7b..d89f91a6fb7fa12d41cc4a346829bff7cbd3e76b 100755 (executable)
--- a/t/t7500-commit.sh
+++ b/t/t7500-commit.sh
test_expect_success 'nonexistent template file should return error' '
echo changes >> foo &&
git add foo &&
- ! git commit --template "$PWD"/notexist
+ test_must_fail git commit --template "$PWD"/notexist
'
test_expect_success 'nonexistent template file in config should return error' '
git config commit.template "$PWD"/notexist &&
- ! git commit &&
+ test_must_fail git commit &&
git config --unset commit.template
'
test_expect_success 'unedited template should not commit' '
echo "template line" > "$TEMPLATE" &&
- ! git commit --template "$TEMPLATE"
+ test_must_fail git commit --template "$TEMPLATE"
'
test_expect_success 'unedited template with comments should not commit' '
echo "# comment in template" >> "$TEMPLATE" &&
- ! git commit --template "$TEMPLATE"
+ test_must_fail git commit --template "$TEMPLATE"
'
test_expect_success 'a Signed-off-by line by itself should not commit' '
diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh
index d3370ff7ff66240f14b8231de7ba0198e73e8deb..0edd9ddf73b7053c21595ce1ac1dd157c77d1bca 100755 (executable)
--- a/t/t7501-commit.sh
+++ b/t/t7501-commit.sh
test_expect_success \
"fail initial amend" \
- "! git-commit --amend"
+ "test_must_fail git-commit --amend"
test_expect_success \
"initial commit" \
test_expect_success \
"invalid options 1" \
- "! git-commit -m foo -m bar -F file"
+ "test_must_fail git-commit -m foo -m bar -F file"
test_expect_success \
"invalid options 2" \
- "! git-commit -C HEAD -m illegal"
+ "test_must_fail git-commit -C HEAD -m illegal"
test_expect_success \
"using paths with -a" \
"echo King of the bongo >file &&
- ! git-commit -m foo -a file"
+ test_must_fail git-commit -m foo -a file"
test_expect_success \
"using paths with --interactive" \
test_expect_success \
"using invalid commit with -C" \
- "! git-commit -C bogus"
+ "test_must_fail git-commit -C bogus"
test_expect_success \
"testing nothing to commit" \
- "! git-commit -m initial"
+ "test_must_fail git-commit -m initial"
test_expect_success \
"next commit" \
test_expect_success \
"commit message from non-existing file" \
"echo 'more bongo: bongo bongo bongo bongo' >file && \
- ! git-commit -F gah -a"
+ test_must_fail git-commit -F gah -a"
# Empty except stray tabs and spaces on a few lines.
sed -e 's/@$//' >msg <<EOF
EOF
test_expect_success \
"empty commit message" \
- "! git-commit -F msg -a"
+ "test_must_fail git-commit -F msg -a"
test_expect_success \
"commit message from file" \
test_expect_success \
"passing -m and -F" \
"echo 'enough with the bongos' >file && \
- ! git-commit -F msg -m amending ."
+ test_must_fail git-commit -F msg -m amending ."
test_expect_success \
"using message from other commit" \
index 2dd5a5e30279e6c3e5ac2be9425c19328a65aff1..b06909599564a1c8afa027b0f9c71ef6bb61d6e4 100755 (executable)
echo "another" >> file &&
git add file &&
- ! git commit -m "another"
+ test_must_fail git commit -m "another"
'
index 88577af9535b5ed7027ec2b6b752df3b78d7bab4..47680e6df41c2bc14f23514b010a8aefb3fedcd7 100755 (executable)
echo "another" >> file &&
git add file &&
- ! git commit -m "another"
+ test_must_fail git commit -m "another"
'
diff --git a/t/t7600-merge.sh b/t/t7600-merge.sh
index d21cd290d3d8e3d912b94045f3d3d9db8bdd7e7d..7d182b5f11ca40b35a74aba04df1086bc91724be 100755 (executable)
--- a/t/t7600-merge.sh
+++ b/t/t7600-merge.sh
echo "[OOPS] unmerged files"
false
fi &&
- if ! git diff --exit-code
+ if test_must_fail git diff --exit-code
then
echo "[OOPS] working tree != index"
false
diff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh
index 6b0483f3e9b77e0bdc42b0c7421db6c60868cf5d..9285071c473dcfe7d37845d01ba20226b5ab585d 100755 (executable)
--- a/t/t7610-mergetool.sh
+++ b/t/t7610-mergetool.sh
git config mergetool.mytool.cmd "cat \"\$REMOTE\" >\"\$MERGED\"" &&
git config mergetool.mytool.trustExitCode true &&
git checkout branch1 &&
- ! git merge master >/dev/null 2>&1 &&
+ test_must_fail git merge master >/dev/null 2>&1 &&
( yes "" | git mergetool file1>/dev/null 2>&1 ) &&
( yes "" | git mergetool file2>/dev/null 2>&1 ) &&
test "$(cat file1)" = "master updated" &&
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 3e4eb63f1c4d63d6ff38c79ff1f7a47fa3aa1597..de5b9802c9deab0f86497bd652eb8b021bcdadb0 100755 (executable)
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
clean_fake_sendmail &&
cp $patches longline.patch &&
echo $z512$z512 >>longline.patch &&
- ! git send-email \
+ test_must_fail git send-email \
--from="Example <nobody@example.com>" \
--to=nobody@example.com \
--smtp-server="$(pwd)/fake.sendmail" \
index 3bc6164125f683d26213035ee9b1ea9199be5792..843a5013b96c675a629bd7f738eca220861e6ff8 100755 (executable)
--- a/t/t9100-git-svn-basic.sh
+++ b/t/t9100-git-svn-basic.sh
git update-index --remove dir/file &&
git update-index --add dir/file/file &&
git commit -m '$name' &&
- ! git-svn set-tree --find-copies-harder --rmdir \
+ test_must_fail git-svn set-tree --find-copies-harder --rmdir \
remotes/git-svn..mybranch" || true
git update-index --remove -- bar/zzz &&
git update-index --add -- bar &&
git commit -m "$name" &&
- ! git-svn set-tree --find-copies-harder --rmdir \
+ test_must_fail git-svn set-tree --find-copies-harder --rmdir \
remotes/git-svn..mybranch2' || true
echo yyy > bar/zzz/yyy &&
git update-index --add bar/zzz/yyy &&
git commit -m "$name" &&
- ! git-svn set-tree --find-copies-harder --rmdir \
+ test_must_fail git-svn set-tree --find-copies-harder --rmdir \
remotes/git-svn..mybranch3' || true
echo asdf > dir &&
git update-index --add -- dir &&
git commit -m "$name" &&
- ! git-svn set-tree --find-copies-harder --rmdir \
+ test_must_fail git-svn set-tree --find-copies-harder --rmdir \
remotes/git-svn..mybranch4' || true
test_expect_success 'exit if remote refs are ambigious' "
git config --add svn-remote.svn.fetch \
bar:refs/remotes/git-svn &&
- ! git-svn migrate
+ test_must_fail git-svn migrate
"
test_expect_success 'exit if init-ing a would clobber a URL' '
svn mkdir -m "mkdir bar" "${svnrepo}2/bar" &&
git config --unset svn-remote.svn.fetch \
"^bar:refs/remotes/git-svn$" &&
- ! git-svn init "${svnrepo}2/bar"
+ test_must_fail git-svn init "${svnrepo}2/bar"
'
test_expect_success \
index 58a3a7b1c333131051282acbae71dc6a1cb16b13..a57ff68e070399e500ad74812291c541edaedd3e 100755 (executable)
test_expect_success 'commit conflicting change from git' '
echo second line from git >> file &&
git commit -a -m "second line from git" &&
- ! git-svn commit-diff -r1 HEAD~1 HEAD "$svnrepo"
+ test_must_fail git-svn commit-diff -r1 HEAD~1 HEAD "$svnrepo"
'
test_expect_success 'commit complementing change from git' '
rm -rf t.svn &&
echo "fourth line from git" >> file &&
git commit -a -m "fourth line from git" &&
- ! git-svn dcommit
+ test_must_fail git-svn dcommit
'
test_expect_success 'dcommit does the svn equivalent of an index merge' "
git commit -a -m 'new file' &&
echo clobber > file &&
git commit -a -m 'clobber' &&
- ! git svn dcommit
+ test_must_fail git svn dcommit
"
index f8f4718c361fc16749fd82fe9bd797643a7a399b..bc37db9d62071ba92463276524675964c3e91593 100755 (executable)
test_expect_success 'attempt to dcommit with a dirty index' '
echo foo >>file &&
git add file &&
- ! git svn dcommit
+ test_must_fail git svn dcommit
'
test_done
index b1dc32d056929ee0cafbd94f6df52669350935b2..3e32e84e6cd32413f98b5189f869bfb8f0a7f354 100755 (executable)
git commit -a -m "generation 2" &&
id=$(git rev-list --max-count=1 HEAD) &&
(cd "$CVSWORK" &&
- ! git cvsexportcommit -c $id
+ test_must_fail git cvsexportcommit -c $id
)'
#test_expect_success \
# git commit -a -m "generation 3" &&
# id=$(git rev-list --max-count=1 HEAD) &&
# (cd "$CVSWORK" &&
-# ! git cvsexportcommit -c $id
+# test_must_fail git cvsexportcommit -c $id
# )'
# We reuse the state from two tests back here
git commit -a -m "Update two" &&
id=$(git rev-list --max-count=1 HEAD) &&
(cd "$CVSWORK" &&
- ! git-cvsexportcommit -c $id
+ test_must_fail git-cvsexportcommit -c $id
)'
case "$(git config --bool core.filemode)" in
diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
index 5edf56f198dc25b9db47ff363fe49958e5299162..e17afa8c30b367091a4bf2175dfc2b663d07aa3b 100755 (executable)
--- a/t/t9300-fast-import.sh
+++ b/t/t9300-fast-import.sh
INPUT_END
test_expect_success 'B: fail on invalid blob sha1' '
- ! git-fast-import <input
+ test_must_fail git-fast-import <input
'
rm -f .git/objects/pack_* .git/objects/index_*
INPUT_END
test_expect_success 'B: fail on invalid branch name ".badbranchname"' '
- ! git-fast-import <input
+ test_must_fail git-fast-import <input
'
rm -f .git/objects/pack_* .git/objects/index_*
INPUT_END
test_expect_success 'B: fail on invalid branch name "bad[branch]name"' '
- ! git-fast-import <input
+ test_must_fail git-fast-import <input
'
rm -f .git/objects/pack_* .git/objects/index_*
INPUT_END
test_expect_success 'E: rfc2822 date, --date-format=raw' '
- ! git-fast-import --date-format=raw <input
+ test_must_fail git-fast-import --date-format=raw <input
'
test_expect_success \
'E: rfc2822 date, --date-format=rfc2822' \
diff --git a/t/t9301-fast-export.sh b/t/t9301-fast-export.sh
index f1bc5ceef0453fcdf711afd6225a5f0cd5dc69e5..0959f2f815ae4d6bd7a8a2a1c8388561dc85dc7d 100755 (executable)
--- a/t/t9301-fast-export.sh
+++ b/t/t9301-fast-export.sh
test $MASTER != $(git rev-parse --verify refs/heads/partial) &&
git diff master..partial &&
git diff master^..partial^ &&
- ! git rev-parse partial~2)
+ test_must_fail git rev-parse partial~2)
'
test_expect_success 'signed-tags=abort' '
- ! git fast-export --signed-tags=abort sign-your-name
+ test_must_fail git fast-export --signed-tags=abort sign-your-name
'