t0060: Fix tests on Windows
[git/dscho.git] / t / t0004-unwritable.sh
blob4700bedab83200674688b40a4f08be5621dc6bc8
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 test_tick &&
19 git commit -m initial &&
20 echo >file &&
21 git add file
25 test_expect_success 'write-tree should notice unwritable repository' '
28 chmod a-w .git/objects .git/objects/?? &&
29 test_must_fail git write-tree
31 status=$?
32 chmod 775 .git/objects .git/objects/??
33 (exit $status)
37 test_expect_success 'commit should notice unwritable repository' '
40 chmod a-w .git/objects .git/objects/?? &&
41 test_must_fail git commit -m second
43 status=$?
44 chmod 775 .git/objects .git/objects/??
45 (exit $status)
49 test_expect_success 'update-index should notice unwritable repository' '
52 echo 6O >file &&
53 chmod a-w .git/objects .git/objects/?? &&
54 test_must_fail git update-index file
56 status=$?
57 chmod 775 .git/objects .git/objects/??
58 (exit $status)
62 test_expect_success 'add should notice unwritable repository' '
65 echo b >file &&
66 chmod a-w .git/objects .git/objects/?? &&
67 test_must_fail git add file
69 status=$?
70 chmod 775 .git/objects .git/objects/??
71 (exit $status)
75 test_done