summaryrefslogtreecommitdiff
path: root/t/t1301-shared-repo.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/t1301-shared-repo.sh')
-rwxr-xr-xt/t1301-shared-repo.sh49
1 files changed, 24 insertions, 25 deletions
diff --git a/t/t1301-shared-repo.sh b/t/t1301-shared-repo.sh
index 84bf197..29cf8a9 100755
--- a/t/t1301-shared-repo.sh
+++ b/t/t1301-shared-repo.sh
@@ -8,6 +8,8 @@ test_description='Test shared repository initialization'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
+TEST_CREATE_REPO_NO_TEMPLATE=1
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# Remove a default ACL from the test dir if possible.
@@ -25,6 +27,7 @@ test_expect_success 'shared = 0400 (faulty permission u-w)' '
for u in 002 022
do
test_expect_success POSIXPERM "shared=1 does not clear bits preset by umask $u" '
+ test_when_finished "rm -rf sub" &&
mkdir sub && (
cd sub &&
umask $u &&
@@ -42,21 +45,30 @@ do
;;
esac
'
- rm -rf sub
done
test_expect_success 'shared=all' '
- mkdir sub &&
- cd sub &&
- git init --shared=all &&
+ git init --template= --shared=all &&
test 2 = $(git config core.sharedrepository)
'
+test_expect_success 'template cannot set core.bare' '
+ test_when_finished "rm -rf subdir" &&
+ test_when_finished "rm -rf templates" &&
+ test_config core.bare true &&
+ umask 0022 &&
+ mkdir -p templates/ &&
+ cp .git/config templates/config &&
+ git init --template=templates subdir &&
+ test_path_is_missing subdir/HEAD
+'
+
test_expect_success POSIXPERM 'update-server-info honors core.sharedRepository' '
: > a1 &&
git add a1 &&
test_tick &&
git commit -m a1 &&
+ mkdir .git/info &&
umask 0277 &&
git update-server-info &&
actual="$(ls -l .git/info/refs)" &&
@@ -88,7 +100,7 @@ do
rm -f .git/info/refs &&
git update-server-info &&
actual="$(test_modebits .git/info/refs)" &&
- verbose test "x$actual" = "x-$y"
+ test "x$actual" = "x-$y"
'
@@ -98,7 +110,7 @@ do
rm -f .git/info/refs &&
git update-server-info &&
actual="$(test_modebits .git/info/refs)" &&
- verbose test "x$actual" = "x-$x"
+ test "x$actual" = "x-$x"
'
@@ -114,23 +126,8 @@ test_expect_success POSIXPERM 'info/refs respects umask in unshared repo' '
test_cmp expect actual
'
-test_expect_success POSIXPERM 'git reflog expire honors core.sharedRepository' '
- umask 077 &&
- git config core.sharedRepository group &&
- git reflog expire --all &&
- actual="$(ls -l .git/logs/refs/heads/main)" &&
- case "$actual" in
- -rw-rw-*)
- : happy
- ;;
- *)
- echo Ooops, .git/logs/refs/heads/main is not 066x [$actual]
- false
- ;;
- esac
-'
-
test_expect_success POSIXPERM 'forced modes' '
+ test_when_finished "rm -rf new" &&
mkdir -p templates/hooks &&
echo update-server-info >templates/hooks/post-update &&
chmod +x templates/hooks/post-update &&
@@ -139,7 +136,8 @@ test_expect_success POSIXPERM 'forced modes' '
(
cd new &&
umask 002 &&
- git init --shared=0660 --template=templates &&
+ git init --shared=0660 --template=../templates &&
+ test_path_is_file .git/hooks/post-update &&
>frotz &&
git add frotz &&
git commit -a -m initial &&
@@ -172,6 +170,7 @@ test_expect_success POSIXPERM 'forced modes' '
'
test_expect_success POSIXPERM 'remote init does not use config from cwd' '
+ test_when_finished "rm -rf child.git" &&
git config core.sharedrepository 0666 &&
umask 0022 &&
git init --bare child.git &&
@@ -191,7 +190,7 @@ test_expect_success POSIXPERM 're-init respects core.sharedrepository (local)' '
'
test_expect_success POSIXPERM 're-init respects core.sharedrepository (remote)' '
- rm -rf child.git &&
+ test_when_finished "rm -rf child.git" &&
umask 0022 &&
git init --bare --shared=0666 child.git &&
test_path_is_missing child.git/foo &&
@@ -202,7 +201,7 @@ test_expect_success POSIXPERM 're-init respects core.sharedrepository (remote)'
'
test_expect_success POSIXPERM 'template can set core.sharedrepository' '
- rm -rf child.git &&
+ test_when_finished "rm -rf child.git" &&
umask 0022 &&
git config core.sharedrepository 0666 &&
cp .git/config templates/config &&