From a4865bf43fbaa522e88d22e6e0bea23c03231d0d Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Sun, 7 Jul 2013 22:24:07 -0700 Subject: [PATCH] Maintain g+w permissons on objects subdirectories After a clone or fetch over the dumb http protocol, any new objects subdirectories that have been created will not honor the core.sharedrepository=1 setting and need to have their permissions adjusted. --- jobd/update.sh | 12 ++++++++++++ taskd/clone.sh | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/jobd/update.sh b/jobd/update.sh index b52dc7b..2b97db1 100755 --- a/jobd/update.sh +++ b/jobd/update.sh @@ -23,6 +23,9 @@ git_bzr_fetch() { set -e trap 'if [ $? != 0 ]; then echo "update failed dir: $PWD" >&2; fi; rm -f "$bang_log"' EXIT +umask 002 +[ "$cfg_permission_control" != "Hooks" ] || umask 000 + proj="$1" cd "$cfg_reporoot/$proj.git" @@ -77,6 +80,15 @@ case "$url" in ;; esac +# The objects subdirectories permissions must be updated now. +# In the case of a dump http clone, the permissions will not be correct +# (missing group write) despite the core.sharedrepository=1 setting! +# The objects themselves seem to have the correct permissions. +# This problem appears to have been fixed in the most recent git versions. +perms=g+w +[ "$cfg_permission_control" != "Hooks" ] || perms=go+w +chmod $perms $(find objects -maxdepth 1 -type d) 2>/dev/null || : + bang git update-server-info bang config_set lastrefresh "$(date "$datefmt")" diff --git a/taskd/clone.sh b/taskd/clone.sh index 3dc324d..3dd38a1 100755 --- a/taskd/clone.sh +++ b/taskd/clone.sh @@ -6,6 +6,9 @@ set -e +umask 002 +[ "$cfg_permission_control" != "Hooks" ] || umask 000 + projdir="$1" proj="${projdir%.git}" @@ -77,6 +80,15 @@ case "$url" in ;; esac +# The objects subdirectories permissions must be updated now. +# In the case of a dump http clone, the permissions will not be correct +# (missing group write) despite the core.sharedrepository=1 setting! +# The objects themselves seem to have the correct permissions. +# This problem appears to have been fixed in the most recent git versions. +perms=g+w +[ "$cfg_permission_control" != "Hooks" ] || perms=go+w +chmod $perms $(find objects -maxdepth 1 -type d) 2>/dev/null || : + # The rest echo "Final touches..." git update-server-info -- 2.11.4.GIT