From 919bbae32ba8104ad5a9074d6cbc9394257f1dd6 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Sat, 10 Feb 2018 07:22:30 -0800 Subject: [PATCH] pre-receive: adjust pack-*.idx permissions too We have been adjusting the permissions of pack-*.pack files for some time now at pre-receive time. Doing so makes it possible to perform repository maintenance more easily and reliably by allowing packs that have been pushed by a chroot jail owner to be manipulated by the Girocco maintenance user. Expand that to include all pack extensions. In order to rename pack files the pack-*.idx also needs group write permission or else the Girocco maintenance user will be forced to copy rather than just hard-link during the rename operation which is much less efficient. Signed-off-by: Kyle J. McKay --- hooks/pre-receive | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hooks/pre-receive b/hooks/pre-receive index 34c10ec..2d744f2 100755 --- a/hooks/pre-receive +++ b/hooks/pre-receive @@ -44,8 +44,8 @@ git config gitweb.lastreceive "$(date '+%a, %d %b %Y %T %z')" # We freshen the new ref in case it's being resurrected to protect it from gc # We probably do not need to do it for new refs as Git tries to do that, # but since we're already doing it for old refs (which Git does not do), -# it's almost no extra work for new refs, just in case. We also attempt -# to make all packs user and group writable so they can be touched later. +# it's almost no extra work for new refs, just in case. We also attempt to +# make all packs user and group writable so they can be touched/renamed later. # Starting with Git v2.11.0 receive-pack packs/objects end up in a quarantine # object directory that is just discarded immediately if pre-receive declines @@ -70,7 +70,7 @@ octet4="$octet$octet$octet$octet" octet20="$octet4$octet4$octet4$octet4$octet4" _make_packs_ugw() { find -L "$1" -maxdepth 1 -type f ! -perm -ug+w \ - -name "pack-$octet20*.pack" -exec chmod ug+w '{}' + || : + -name "pack-$octet20*.*" -exec chmod ug+w '{}' + || : } 2>/dev/null _make_packs_ugw objects/pack [ -z "$GIT_QUARANTINE_PATH" ] || _make_packs_ugw "$GIT_QUARANTINE_PATH/pack" -- 2.11.4.GIT