Merge branch 'master' of git://git.kernel.org/pub/scm/git/git
[git/jnareb-git.git] / t / t0004-unwritable.sh
blobe3137d638ee5bb07b9278c1a9b90a207ad024a08
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,SANITY 'write-tree should notice unwritable repository' '
19 test_when_finished "chmod 775 .git/objects .git/objects/??" &&
20 chmod a-w .git/objects .git/objects/?? &&
21 test_must_fail git write-tree
24 test_expect_success POSIXPERM,SANITY 'commit should notice unwritable repository' '
25 test_when_finished "chmod 775 .git/objects .git/objects/??" &&
26 chmod a-w .git/objects .git/objects/?? &&
27 test_must_fail git commit -m second
30 test_expect_success POSIXPERM,SANITY 'update-index should notice unwritable repository' '
31 test_when_finished "chmod 775 .git/objects .git/objects/??" &&
32 echo 6O >file &&
33 chmod a-w .git/objects .git/objects/?? &&
34 test_must_fail git update-index file
37 test_expect_success POSIXPERM,SANITY 'add should notice unwritable repository' '
38 test_when_finished "chmod 775 .git/objects .git/objects/??" &&
39 echo b >file &&
40 chmod a-w .git/objects .git/objects/?? &&
41 test_must_fail git add file
44 test_done