Code

bash completion: Resolve git show ref:path<tab> losing ref: portion
[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         git commit -m initial &&
12         echo >file &&
13         git add file
15 '
17 test_expect_success 'write-tree should notice unwritable repository' '
19         (
20                 chmod a-w .git/objects
21                 test_must_fail git write-tree
22         )
23         status=$?
24         chmod 775 .git/objects
25         (exit $status)
27 '
29 test_expect_success 'commit should notice unwritable repository' '
31         (
32                 chmod a-w .git/objects
33                 test_must_fail git commit -m second
34         )
35         status=$?
36         chmod 775 .git/objects
37         (exit $status)
39 '
41 test_expect_success 'update-index should notice unwritable repository' '
43         (
44                 echo a >file &&
45                 chmod a-w .git/objects
46                 test_must_fail git update-index file
47         )
48         status=$?
49         chmod 775 .git/objects
50         (exit $status)
52 '
54 test_expect_success 'add should notice unwritable repository' '
56         (
57                 echo b >file &&
58                 chmod a-w .git/objects
59                 test_must_fail git add file
60         )
61         status=$?
62         chmod 775 .git/objects
63         (exit $status)
65 '
67 test_done