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 <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Christian Couder committed Jun 25, 2017 at 06:34 UTC 3ee83f48e5cfdfe2e3c783df1f3162e9383732fa
1 file changed +30
t/t1700-split-index.sh
+30
@@ -370,4 +370,34 @@ test_expect_success 'check splitIndex.sharedIndexExpire set to "never" and "now"
370 test $(ls .git/sharedindex.* | wc -l) -le 2
371 '
372
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 +
403 test_done