Merge branch 'sg/complete-decorate-full-not-long'
[gitweb.git] / t / t1301-shared-repo.sh
index de42d21c922045415abedf3c81163682d0754eb5..ac108754088d34758a75f14943516c4a701f0ca8 100755 (executable)
@@ -12,12 +12,11 @@ setfacl -k . 2>/dev/null
 
 # User must have read permissions to the repo -> failure on --shared=0400
 test_expect_success 'shared = 0400 (faulty permission u-w)' '
+       test_when_finished "rm -rf sub" &&
        mkdir sub && (
-               cd sub && git init --shared=0400
+               cd sub &&
+               test_must_fail git init --shared=0400
        )
-       ret="$?"
-       rm -rf sub
-       test $ret != "0"
 '
 
 modebits () {
@@ -33,7 +32,7 @@ do
                        git init --shared=1 &&
                        test 1 = "$(git config core.sharedrepository)"
                ) &&
-               actual=$(ls -l sub/.git/HEAD)
+               actual=$(ls -l sub/.git/HEAD) &&
                case "$actual" in
                -rw-rw-r--*)
                        : happy
@@ -90,10 +89,8 @@ do
                rm -f .git/info/refs &&
                git update-server-info &&
                actual="$(modebits .git/info/refs)" &&
-               test "x$actual" = "x-$y" || {
-                       ls -lt .git/info
-                       false
-               }
+               verbose test "x$actual" = "x-$y"
+
        '
 
        umask 077 &&
@@ -102,16 +99,24 @@ do
                rm -f .git/info/refs &&
                git update-server-info &&
                actual="$(modebits .git/info/refs)" &&
-               test "x$actual" = "x-$x" || {
-                       ls -lt .git/info
-                       false
-               }
+               verbose test "x$actual" = "x-$x"
 
        '
 
 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)" &&