From c6d18c7b4dd03a023c0e6871fe289f5d651b9d37 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Fri, 13 Feb 2015 12:00:47 -0800 Subject: [PATCH] gc.sh: remove any stale shallow clone turds Git >= 1.8.4.2 and < 2.0.0 creates shallow_XXXXXX files in the .git directory to serve shallow clones to clients. In some cases these files can be left behind. If any of these shallow clone turds are found more than 12 hours old, remove then at gc time. --- jobd/gc.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/jobd/gc.sh b/jobd/gc.sh index 3b239c7..406648e 100755 --- a/jobd/gc.sh +++ b/jobd/gc.sh @@ -244,6 +244,14 @@ while read packtmp; do rm -f "$packtmp" done +# Remove any stale shallow_* files that are more than 12 hours old. +# These can be left behind by Git >= 1.8.4.2 and < 2.0.0 when a client +# requests a shallow clone. +find . -maxdepth 1 -type f -mmin +720 -name "shallow_?*" -print | \ +while read turd; do + rm -f "$turd" +done + # Remove any stale *.temp files in the objects area that are more than 12 hours old. # This can be stale sha1.temp, or stale *.pack.temp so we kill all stale *.temp. find objects -type f -mmin +720 -name "*.temp" -print | \ -- 2.11.4.GIT