Windows ANSI - hook write()
[git/mingw/4msysgit/peterh.git] / t / t0004-unwritable.sh
blobf1385d6ded73e41bb0db82855950ff7db43a5e19
1 #!/bin/sh
3 test_description='detect unwritable repository and fail correctly'
5 . ./test-lib.sh
7 case "$(uname -s)" in
8 *MINGW*)
9 say "chmod a-w .git/objects does not make directory unwritable - skipping tests"
10 test_done
12 esac
14 test_expect_success setup '
16 >file &&
17 git add file &&
18 git commit -m initial &&
19 echo >file &&
20 git add file
24 test_expect_success 'write-tree should notice unwritable repository' '
27 chmod a-w .git/objects
28 test_must_fail git write-tree
30 status=$?
31 chmod 775 .git/objects
32 (exit $status)
36 test_expect_success 'commit should notice unwritable repository' '
39 chmod a-w .git/objects
40 test_must_fail git commit -m second
42 status=$?
43 chmod 775 .git/objects
44 (exit $status)
48 test_expect_success 'update-index should notice unwritable repository' '
51 echo a >file &&
52 chmod a-w .git/objects
53 test_must_fail git update-index file
55 status=$?
56 chmod 775 .git/objects
57 (exit $status)
61 test_expect_success 'add should notice unwritable repository' '
64 echo b >file &&
65 chmod a-w .git/objects
66 test_must_fail git add file
68 status=$?
69 chmod 775 .git/objects
70 (exit $status)
74 test_done