Unify code paths of threaded greps
[alt-git.git] / t / t0004-unwritable.sh
blob2342ac5788a9976b591cb78593279f092d1dc2f6
1 #!/bin/sh
3 test_description='detect unwritable repository and fail correctly'
5 . ./test-lib.sh
7 test_expect_success setup '
9 >file &&
10 git add file &&
11 test_tick &&
12 git commit -m initial &&
13 echo >file &&
14 git add file
18 test_expect_success POSIXPERM 'write-tree should notice unwritable repository' '
21 chmod a-w .git/objects .git/objects/?? &&
22 test_must_fail git write-tree
24 status=$?
25 chmod 775 .git/objects .git/objects/??
26 (exit $status)
30 test_expect_success POSIXPERM 'commit should notice unwritable repository' '
33 chmod a-w .git/objects .git/objects/?? &&
34 test_must_fail git commit -m second
36 status=$?
37 chmod 775 .git/objects .git/objects/??
38 (exit $status)
42 test_expect_success POSIXPERM 'update-index should notice unwritable repository' '
45 echo 6O >file &&
46 chmod a-w .git/objects .git/objects/?? &&
47 test_must_fail git update-index file
49 status=$?
50 chmod 775 .git/objects .git/objects/??
51 (exit $status)
55 test_expect_success POSIXPERM 'add should notice unwritable repository' '
58 echo b >file &&
59 chmod a-w .git/objects .git/objects/?? &&
60 test_must_fail git add file
62 status=$?
63 chmod 775 .git/objects .git/objects/??
64 (exit $status)
68 test_done