aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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,