aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKelley Spoon <kelley.spoon@linaro.org>2018-10-24 09:34:19 -0500
committerKelley Spoon <kelley.spoon@linaro.org>2018-10-26 12:29:52 +0000
commitd057f4708382ff4c9f3073d0cb0d8a96e66e54fb (patch)
treeacef7fe07fe39cd169e8ba0a908502304b2598a4
parent62a272b06962b9ec6d2e6bd76873e1feebad440c (diff)
downloadlinaro-git-tools-master.tar.gz
Git: trigger git prune if a repo has pack files older than 1 weekHEADmaster
This change adds a check to call 'git clean' with prune if the repo has any pack files that are more than a week old. Previously we were relying on the result of 'git fsck' which were allowing extraneous pack files to accumulate and take up disk space. Change-Id: Ic4b7c9ed17841b130f86be70742bec1e811645ac
-rwxr-xr-xgit_cleaner.sh5
1 files changed, 3 insertions, 2 deletions
diff --git a/git_cleaner.sh b/git_cleaner.sh
index 31030a2..f870499 100755
--- a/git_cleaner.sh
+++ b/git_cleaner.sh
@@ -27,8 +27,9 @@ do
rm -f ${repo}/gc.log
fi
- # check for dangling commits and orphans
- if [ ! -z "$(git fsck --connectivity-only --no-progress)" ];
+ # check for dangling commits and orphans or files older than a week
+ if [ ! -z "$(find . -type f -name "*.pack" -mtime +7)" ] || \
+ [ ! -z "$(git fsck --connectivity-only --no-progress)" ];
then
# this causes dangling refs to expire now and prunes
# them from the object pack. It's expensive, however,