Code

tests: factor out terminal handling from t7006
[git.git] / t / t0004-unwritable.sh
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
16 '
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
22 '
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
28 '
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
35 '
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
42 '
44 test_done