git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
blob 998c9d1be69bdda4b72739a2e3258a4328519027 2169 bytes (raw)
name: t/t0004-unwritable.sh 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
 
#!/bin/sh

test_description='detect unwritable repository and fail correctly'

. ./test-lib.sh

test_expect_success setup '

	>file &&
	git add file &&
	test_tick &&
	git commit -m initial &&
	echo >file &&
	git add file

'

test_expect_success POSIXPERM,SANITY 'write-tree should notice unwritable repository' '
	test_when_finished "chmod 775 .git/objects .git/objects/??" &&
	chmod a-w .git/objects .git/objects/?? &&

	cat >expect <<-\EOF &&
	error: insufficient permission for adding an object to repository database .git/objects
	fatal: git-write-tree: error building trees
	EOF
	test_must_fail git write-tree 2>actual &&
	test_cmp expect actual
'

test_expect_success POSIXPERM,SANITY 'commit should notice unwritable repository' '
	test_when_finished "chmod 775 .git/objects .git/objects/??" &&
	chmod a-w .git/objects .git/objects/?? &&

	cat >expect <<-\EOF &&
	error: insufficient permission for adding an object to repository database .git/objects
	error: insufficient permission for adding an object to repository database .git/objects
	error: Error building trees
	EOF
	test_must_fail git commit -m second 2>actual &&
	test_cmp expect actual
'

test_expect_success POSIXPERM,SANITY 'update-index should notice unwritable repository' '
	test_when_finished "chmod 775 .git/objects .git/objects/??" &&
	echo 6O >file &&
	chmod a-w .git/objects .git/objects/?? &&

	cat >expect <<-\EOF &&
	error: insufficient permission for adding an object to repository database .git/objects
	error: file: failed to insert into database
	fatal: Unable to process path file
	EOF
	test_must_fail git update-index file 2>actual &&
	test_cmp expect actual
'

test_expect_success POSIXPERM,SANITY 'add should notice unwritable repository' '
	test_when_finished "chmod 775 .git/objects .git/objects/??" &&
	echo b >file &&
	chmod a-w .git/objects .git/objects/?? &&

	cat >expect <<-\EOF &&
	error: insufficient permission for adding an object to repository database .git/objects
	error: file: failed to insert into database
	error: unable to index file '\''file'\''
	fatal: updating files failed
	EOF
	test_must_fail git add file 2>actual &&
	test_cmp expect actual
'

test_done

debug log:

solving 998c9d1be69 ...
found 998c9d1be69 in https://public-inbox.org/git/patch-1.2-a5ef8ea47f4-20211009T133354Z-avarab@gmail.com/
found e3137d638ee in https://80x24.org/mirrors/git.git
preparing index
index prepared:
100755 e3137d638ee5bb07b9278c1a9b90a207ad024a08	t/t0004-unwritable.sh

applying [1/1] https://public-inbox.org/git/patch-1.2-a5ef8ea47f4-20211009T133354Z-avarab@gmail.com/
diff --git a/t/t0004-unwritable.sh b/t/t0004-unwritable.sh
index e3137d638ee..998c9d1be69 100755

Checking patch t/t0004-unwritable.sh...
Applied patch t/t0004-unwritable.sh cleanly.

index at:
100755 998c9d1be69bdda4b72739a2e3258a4328519027	t/t0004-unwritable.sh

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).