From 13489e9fce30a75fc0447acac95e1d6304d1488e Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Fri, 21 Feb 2014 18:00:27 -0800 Subject: [PATCH] gc.sh: shorten any darcs .log files When cloning a darcs:// source, a darcs .log file is created that just grows without bound. To mitigate this, shorten it to the last 10000 lines at gc time. --- jobd/gc.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/jobd/gc.sh b/jobd/gc.sh index f6bc265..5a3c0b6 100755 --- a/jobd/gc.sh +++ b/jobd/gc.sh @@ -116,6 +116,19 @@ git pack-refs --all git repack -a -d --window=50 --window-memory=1G --depth=50 -l $quiet git prune git update-server-info +# darcs:// mirrors have a xxx.log file that will grow endlessly +# if this is a mirror and the file exists, shorten it to 10000 lines +if [ ! -e .nofetch ]; then + url="$(config_get baseurl || :)" + case "$url" in darcs://*) + url="${url%/}" + basedarcs="$(basename "${url#darcs:/}")" + if [ -f "$basedarcs.log" ]; then + tail -n 10000 "$basedarcs.log" > "$basedarcs.log.$$" + mv -f "$basedarcs.log.$$" "$basedarcs.log" + fi + esac +fi config_set lastgc "$(date "$datefmt")" rm "$lockf" -- 2.11.4.GIT