]>
Commit | Line | Data |
---|---|---|
1 | #!/bin/sh | |
2 | ||
3 | test_description='detect unwritable repository and fail correctly' | |
4 | ||
5 | . ./test-lib.sh | |
6 | ||
7 | test_expect_success setup ' | |
8 | ||
9 | >file && | |
10 | git add file && | |
11 | test_tick && | |
12 | git commit -m initial && | |
13 | echo >file && | |
14 | git add file | |
15 | ||
16 | ' | |
17 | ||
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 | ' | |
23 | ||
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 | ' | |
29 | ||
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 | ' | |
36 | ||
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 | ' | |
43 | ||
44 | test_done |