summaryrefslogtreecommitdiffstats
path: root/git-hooks
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@digia.com>2014-10-20 15:05:13 +0200
committerOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2014-10-29 13:43:40 +0100
commite70dab391da27166973e4ed8a8ea5052ca3dacf1 (patch)
tree39ae8c8a819d00a735bdea10cd6aff92e7d66ee7 /git-hooks
parent085d02fcfbe790bb8b63cadf8a5e1b59e271d1ab (diff)
deal with overzealous garbage collection
every repo should have refs/changes (because fetching changes is the first thing the bot does after cloning a repo), but with the default config, gc will pack the refs, and the directory vanishes if no refs were created for too long (which also breaks our cleanup). don't error out when that happens. also document how to avoid that situation to start with. Change-Id: I92d539785a9810c02263f954d9299169d2fa3f2c Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Simo Fält <simo.falt@digia.com>
Diffstat (limited to 'git-hooks')
-rwxr-xr-xgit-hooks/gerrit-bot-cleanup2
1 files changed, 2 insertions, 0 deletions
diff --git a/git-hooks/gerrit-bot-cleanup b/git-hooks/gerrit-bot-cleanup
index 97cfde3..ca8da11 100755
--- a/git-hooks/gerrit-bot-cleanup
+++ b/git-hooks/gerrit-bot-cleanup
@@ -20,6 +20,8 @@ if test -z "$root"; then
fi
cd "$root" || exit
find -name '*.git' -type d -prune | while read dir; do (
+ # use "git config --global gc.packrefs notbare" to make sure this works
+ test -d $dir/refs/changes || exit
echo "Entering $dir ..."
cd "$dir" || exit
find refs/changes -mindepth 1 -mtime +10 -delete