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:
authorJonathan Nieder <jrnieder@gmail.com>2010-09-07 05:50:17 +0400
committerJunio C Hamano <gitster@pobox.com>2010-09-30 21:39:06 +0400
commitdbda967684dfefd0ac3518f9805ccf9ded9af429 (patch)
treebfe19181c3eff2748b21fa68c75135fa7120bc31 /t/t0004-unwritable.sh
parente14712c9e6801855a033ee1e7013f54580f270a1 (diff)
t0004 (unwritable files): simplify error handling
Instead of ... normal test script ... status=$? ... cleanup ... (exit $status) set up cleanup commands with test_when_finished. This makes the test script a little shorter, and more importantly, it ensures errors during cleanup are reported. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t0004-unwritable.sh')
-rwxr-xr-xt/t0004-unwritable.sh52
1 files changed, 14 insertions, 38 deletions
diff --git a/t/t0004-unwritable.sh b/t/t0004-unwritable.sh
index 385b1265de..e3137d638e 100755
--- a/t/t0004-unwritable.sh
+++ b/t/t0004-unwritable.sh
@@ -16,53 +16,29 @@ test_expect_success setup '
'
test_expect_success POSIXPERM,SANITY 'write-tree should notice unwritable repository' '
-
- (
- chmod a-w .git/objects .git/objects/?? &&
- test_must_fail git write-tree
- )
- status=$?
- chmod 775 .git/objects .git/objects/??
- (exit $status)
-
+ test_when_finished "chmod 775 .git/objects .git/objects/??" &&
+ chmod a-w .git/objects .git/objects/?? &&
+ test_must_fail git write-tree
'
test_expect_success POSIXPERM,SANITY 'commit should notice unwritable repository' '
-
- (
- chmod a-w .git/objects .git/objects/?? &&
- test_must_fail git commit -m second
- )
- status=$?
- chmod 775 .git/objects .git/objects/??
- (exit $status)
-
+ test_when_finished "chmod 775 .git/objects .git/objects/??" &&
+ chmod a-w .git/objects .git/objects/?? &&
+ test_must_fail git commit -m second
'
test_expect_success POSIXPERM,SANITY 'update-index should notice unwritable repository' '
-
- (
- echo 6O >file &&
- chmod a-w .git/objects .git/objects/?? &&
- test_must_fail git update-index file
- )
- status=$?
- chmod 775 .git/objects .git/objects/??
- (exit $status)
-
+ test_when_finished "chmod 775 .git/objects .git/objects/??" &&
+ echo 6O >file &&
+ chmod a-w .git/objects .git/objects/?? &&
+ test_must_fail git update-index file
'
test_expect_success POSIXPERM,SANITY 'add should notice unwritable repository' '
-
- (
- echo b >file &&
- chmod a-w .git/objects .git/objects/?? &&
- test_must_fail git add file
- )
- status=$?
- chmod 775 .git/objects .git/objects/??
- (exit $status)
-
+ test_when_finished "chmod 775 .git/objects .git/objects/??" &&
+ echo b >file &&
+ chmod a-w .git/objects .git/objects/?? &&
+ test_must_fail git add file
'
test_done