diff options
author | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2012-06-06 18:12:59 +0200 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2012-06-07 10:51:46 +0200 |
commit | 9e791325bc9a5967c222ef56278ee5ca9b04a13f (patch) | |
tree | ca730ad6c58dcada35454f107567d332927ef896 | |
parent | 1b25f02b80b4c8ce5888ecff137f8aaaf3d50997 (diff) |
add cleanup script for sanity bot
if the sanity bot is configured with gitdofetch=1, the repos need a
periodic cleanup - otherwise they become amazingly slow (a simple fetch
can take minutes before anything happens).
i was too lazy make this an option of the sanity-bot script itself.
maybe later.
Change-Id: I85306264cd67d321c10cb069e5bfb5b60b2ca6db
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
-rwxr-xr-x | git-hooks/gerrit-bot-cleanup | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/git-hooks/gerrit-bot-cleanup b/git-hooks/gerrit-bot-cleanup new file mode 100755 index 0000000..1216418 --- /dev/null +++ b/git-hooks/gerrit-bot-cleanup @@ -0,0 +1,24 @@ +#! /bin/sh + +# Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +# Contact: http://www.qt-project.org/ +# +# You may use this file under the terms of the 3-clause BSD license. +# See the file LICENSE from this package for details. +# + +# Run this once a day (from a cron job) to keep the sanity bot's +# git clones performing well. + +root=$(git config sanitybot.gitbasedir) +if test -z "$root"; then + echo "Error: sanitybot.gitbasedir not set" >&2 + exit 1 +fi +cd "$root" || exit +find -name '*.git' -type d | while read dir; do ( + echo "Entering $dir ..." + cd "$dir" || exit + find refs/changes -mindepth 1 -mtime +10 -delete + git gc +); done |