Skip to content

Commit 69d8780

Browse files
pks-tgitster
authored andcommitted
t0610: execute git-pack-refs(1) with specified umask
The tests for git-pack-refs(1) with the `core.sharedRepository` config execute git-pack-refs(1) outside of the shell that has the expected umask set. This is wrong because we want to test the behaviour of that command with different umasks. The issue went unnoticed because most distributions have a default umask of 0022, and we only ever test with `--shared=true`, which re-adds the group write bit. Fix the issue by moving git-pack-refs(1) into the umask'd shell and add a bunch of test cases that exercise behaviour more thoroughly. Note that we drop the check for whether `core.sharedRepository` was set to the correct value to make the test setup a bit easier. We should be able to rely on git-init(1) doing its thing correctly. Furthermore, to help readability, we convert tests that pass `--shared=true` to instead pass the equivalent `--shared=group`. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2f960dd commit 69d8780

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

t/t0610-reftable-basics.sh

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,7 @@ test_expect_reftable_perms () {
105105
test_when_finished "rm -rf repo" &&
106106
(
107107
umask $umask &&
108-
git init --shared=$shared repo &&
109-
test 1 = "$(git -C repo config core.sharedrepository)"
108+
git init --shared=$shared repo
110109
) &&
111110
test_expect_perms "$expect" repo/.git/reftable/tables.list &&
112111
for table in repo/.git/reftable/*.ref
@@ -122,9 +121,9 @@ test_expect_reftable_perms () {
122121
umask $umask &&
123122
git init --shared=$shared repo &&
124123
test_commit -C repo A &&
125-
test_line_count = 3 repo/.git/reftable/tables.list
124+
test_line_count = 3 repo/.git/reftable/tables.list &&
125+
git -C repo pack-refs
126126
) &&
127-
git -C repo pack-refs &&
128127
test_expect_perms "$expect" repo/.git/reftable/tables.list &&
129128
for table in repo/.git/reftable/*.ref
130129
do
@@ -134,8 +133,17 @@ test_expect_reftable_perms () {
134133
'
135134
}
136135

137-
test_expect_reftable_perms 002 true "-rw-rw-r--"
138-
test_expect_reftable_perms 022 true "-rw-rw-r--"
136+
test_expect_reftable_perms 002 umask "-rw-rw-r--"
137+
test_expect_reftable_perms 022 umask "-rw-r--r--"
138+
test_expect_reftable_perms 027 umask "-rw-r-----"
139+
140+
test_expect_reftable_perms 002 group "-rw-rw-r--"
141+
test_expect_reftable_perms 022 group "-rw-rw-r--"
142+
test_expect_reftable_perms 027 group "-rw-rw----"
143+
144+
test_expect_reftable_perms 002 world "-rw-rw-r--"
145+
test_expect_reftable_perms 022 world "-rw-rw-r--"
146+
test_expect_reftable_perms 027 world "-rw-rw-r--"
139147

140148
test_expect_success 'clone: can clone reftable repository' '
141149
test_when_finished "rm -rf repo clone" &&

0 commit comments

Comments
 (0)