]> git.ipfire.org Git - thirdparty/git.git/blame - t/t0004-unwritable.sh
status: fix bug with missing --ignore files
[thirdparty/git.git] / t / t0004-unwritable.sh
CommitLineData
edae5f0c
JH
1#!/bin/sh
2
3test_description='detect unwritable repository and fail correctly'
4
5. ./test-lib.sh
6
7test_expect_success setup '
8
9 >file &&
10 git add file &&
329636b4 11 test_tick &&
edae5f0c
JH
12 git commit -m initial &&
13 echo >file &&
14 git add file
15
16'
17
ee9fb68c 18test_expect_success POSIXPERM 'write-tree should notice unwritable repository' '
edae5f0c
JH
19
20 (
329636b4 21 chmod a-w .git/objects .git/objects/?? &&
edae5f0c
JH
22 test_must_fail git write-tree
23 )
24 status=$?
329636b4 25 chmod 775 .git/objects .git/objects/??
edae5f0c
JH
26 (exit $status)
27
28'
29
ee9fb68c 30test_expect_success POSIXPERM 'commit should notice unwritable repository' '
edae5f0c
JH
31
32 (
329636b4 33 chmod a-w .git/objects .git/objects/?? &&
edae5f0c
JH
34 test_must_fail git commit -m second
35 )
36 status=$?
329636b4 37 chmod 775 .git/objects .git/objects/??
edae5f0c
JH
38 (exit $status)
39
40'
41
ee9fb68c 42test_expect_success POSIXPERM 'update-index should notice unwritable repository' '
edae5f0c
JH
43
44 (
329636b4
JH
45 echo 6O >file &&
46 chmod a-w .git/objects .git/objects/?? &&
edae5f0c
JH
47 test_must_fail git update-index file
48 )
49 status=$?
329636b4 50 chmod 775 .git/objects .git/objects/??
edae5f0c
JH
51 (exit $status)
52
53'
54
ee9fb68c 55test_expect_success POSIXPERM 'add should notice unwritable repository' '
edae5f0c
JH
56
57 (
58 echo b >file &&
329636b4 59 chmod a-w .git/objects .git/objects/?? &&
edae5f0c
JH
60 test_must_fail git add file
61 )
62 status=$?
329636b4 63 chmod 775 .git/objects .git/objects/??
edae5f0c
JH
64 (exit $status)
65
66'
67
68test_done