X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=t%2Ft1301-shared-repo.sh;h=3fddc9ee781ba9fb5d189bbc5ec0b900b159723a;hb=1d49f0d1a1b7b2941e56cf8384a7a4267e98150c;hp=653362ba221ee017512264c83a216b1ad1723bcd;hpb=fcd3549ef239378d1d2ca11df9e8c91f7fa0ab2e;p=git.git diff --git a/t/t1301-shared-repo.sh b/t/t1301-shared-repo.sh index 653362ba2..3fddc9ee7 100755 --- a/t/t1301-shared-repo.sh +++ b/t/t1301-shared-repo.sh @@ -126,4 +126,45 @@ test_expect_success 'git reflog expire honors core.sharedRepository' ' esac ' +test_expect_success 'forced modes' ' + mkdir -p templates/hooks && + echo update-server-info >templates/hooks/post-update && + chmod +x templates/hooks/post-update && + echo : >random-file && + mkdir new && + ( + cd new && + umask 002 && + git init --shared=0660 --template=../templates && + >frotz && + git add frotz && + git commit -a -m initial && + git repack + ) && + # List repository files meant to be protected; note that + # COMMIT_EDITMSG does not matter---0mode is not about a + # repository with a work tree. + find new/.git -type f -name COMMIT_EDITMSG -prune -o -print | + xargs ls -ld >actual && + + # Everything must be unaccessible to others + test -z "$(sed -e "/^.......---/d" actual)" && + + # All directories must have either 2770 or 770 + test -z "$(sed -n -e "/^drwxrw[sx]---/d" -e "/^d/p" actual)" && + + # post-update hook must be 0770 + test -z "$(sed -n -e "/post-update/{ + /^-rwxrwx---/d + p + }" actual)" && + + # All files inside objects must be accessible by us + test -z "$(sed -n -e "/objects\//{ + /^d/d + /^-r.-r.----/d + p + }" actual)" +' + test_done