Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2015-03-20 13:12:51 +0300
committerJunio C Hamano <gitster@pobox.com>2015-03-20 20:20:17 +0300
commit27a6625b13d7475d28f425adb2b7be221cf3c8e0 (patch)
treef9b96a03125d22f5c2646a85ceedffefdf018d19 /t/t3600-rm.sh
parent53350a35a3c29417dfc64ae2b0d7a16ba43d1239 (diff)
t3600: fix &&-chain breakage for setup commands
As with the earlier patch to fix "trivial" &&-chain breakage, these missing "&&" operators are not a serious problem (e.g., we do not expect "echo" to fail). Ironically, however, inserting them shows that some of the commands _do_ fail. Specifically, some of the tests start by making sure we are at a commit with the string "content" in the file "foo". However, running "git commit" may fail because the previous test left us in that state already, and there is nothing to commit. We could remove these commands entirely, but they serve to document the test's assumptions, as well as make it robust when an earlier test has failed. We could use test_might_fail to handle all cases, but that would miss an unrelated failure to make the commit. Instead, we can just pass the --allow-empty flag to git-commit, which means that it will not complain if our setup is a noop. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3600-rm.sh')
-rwxr-xr-xt/t3600-rm.sh36
1 files changed, 18 insertions, 18 deletions
diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh
index 1962989971..9d90d2c935 100755
--- a/t/t3600-rm.sh
+++ b/t/t3600-rm.sh
@@ -38,37 +38,37 @@ test_expect_success \
test_expect_success \
'Test that git rm --cached foo succeeds if the index matches the file' \
- 'echo content > foo
- git add foo
+ 'echo content >foo &&
+ git add foo &&
git rm --cached foo'
test_expect_success \
'Test that git rm --cached foo succeeds if the index matches the file' \
- 'echo content > foo
- git add foo
- git commit -m foo
- echo "other content" > foo
+ 'echo content >foo &&
+ git add foo &&
+ git commit -m foo &&
+ echo "other content" >foo &&
git rm --cached foo'
test_expect_success \
'Test that git rm --cached foo fails if the index matches neither the file nor HEAD' '
- echo content > foo
- git add foo
- git commit -m foo
- echo "other content" > foo
- git add foo
- echo "yet another content" > foo
+ echo content >foo &&
+ git add foo &&
+ git commit -m foo --allow-empty &&
+ echo "other content" >foo &&
+ git add foo &&
+ echo "yet another content" >foo &&
test_must_fail git rm --cached foo
'
test_expect_success \
'Test that git rm --cached -f foo works in case where --cached only did not' \
- 'echo content > foo
- git add foo
- git commit -m foo
- echo "other content" > foo
- git add foo
- echo "yet another content" > foo
+ 'echo content >foo &&
+ git add foo &&
+ git commit -m foo --allow-empty &&
+ echo "other content" >foo &&
+ git add foo &&
+ echo "yet another content" >foo &&
git rm --cached -f foo'
test_expect_success \