Merge branch 'jc/decorate-leaky-separator-color' into maint
[gitweb.git] / t / t1301-shared-repo.sh
index 750fbb32e87e0eb8f7a95928f9b407036822c7ad..7eecfb836a05cac56b8eca1ac56f67e8b22b1fbd 100755 (executable)
@@ -111,7 +111,18 @@ do
 
 done
 
+test_expect_success POSIXPERM 'info/refs respects umask in unshared repo' '
+       rm -f .git/info/refs &&
+       test_unconfig core.sharedrepository &&
+       umask 002 &&
+       git update-server-info &&
+       echo "-rw-rw-r--" >expect &&
+       modebits .git/info/refs >actual &&
+       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/master)" &&
@@ -126,7 +137,7 @@ test_expect_success POSIXPERM 'git reflog expire honors core.sharedRepository' '
        esac
 '
 
-test_expect_success 'forced modes' '
+test_expect_success POSIXPERM 'forced modes' '
        mkdir -p templates/hooks &&
        echo update-server-info >templates/hooks/post-update &&
        chmod +x templates/hooks/post-update &&
@@ -141,11 +152,14 @@ test_expect_success 'forced modes' '
                git commit -a -m initial &&
                git repack
        ) &&
-       find new/.git -print |
+       # 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 -n -e "/^.......---/d" actual)" &&
+       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)" &&
@@ -156,10 +170,11 @@ test_expect_success 'forced modes' '
                p
        }" actual)" &&
 
-       # All files inside objects must be 0440
+       # All files inside objects must be accessible by us
        test -z "$(sed -n -e "/objects\//{
                /^d/d
-               /^-r--r-----/d
+               /^-r.-r.----/d
+               p
        }" actual)"
 '