Skip to content

Commit 3ee83f4

Browse files
chriscoolgitster
authored andcommitted
t1700: make sure split-index respects core.sharedrepository
Add a few tests to check that both the split-index file and the shared-index file are created using the right permissions when core.sharedrepository is set. Signed-off-by: Christian Couder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 73de1c9 commit 3ee83f4

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

t/t1700-split-index.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,4 +370,34 @@ test_expect_success 'check splitIndex.sharedIndexExpire set to "never" and "now"
370370
test $(ls .git/sharedindex.* | wc -l) -le 2
371371
'
372372

373+
while read -r mode modebits
374+
do
375+
test_expect_success POSIXPERM "split index respects core.sharedrepository $mode" '
376+
# Remove existing shared index files
377+
git config core.splitIndex false &&
378+
git update-index --force-remove one &&
379+
rm -f .git/sharedindex.* &&
380+
# Create one new shared index file
381+
git config core.sharedrepository "$mode" &&
382+
git config core.splitIndex true &&
383+
: >one &&
384+
git update-index --add one &&
385+
echo "$modebits" >expect &&
386+
test_modebits .git/index >actual &&
387+
test_cmp expect actual &&
388+
shared=$(ls .git/sharedindex.*) &&
389+
case "$shared" in
390+
*" "*)
391+
# we have more than one???
392+
false ;;
393+
*)
394+
test_modebits "$shared" >actual &&
395+
test_cmp expect actual ;;
396+
esac
397+
'
398+
done <<\EOF
399+
0666 -rw-rw-rw-
400+
0642 -rw-r---w-
401+
EOF
402+
373403
test_done

0 commit comments

Comments
 (0)