From 9aa9ac481687a1fd54d08a32c1ebbe04fc112526 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Fri, 11 Apr 2014 17:02:17 -0700 Subject: [PATCH] gc.sh: optimize darcs repositories When running gc on a mirror that is a darcs: source, also optimize the .darcs repository to help reduce its footprint. --- jobd/gc.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/jobd/gc.sh b/jobd/gc.sh index 5a3c0b6..ddedf30 100755 --- a/jobd/gc.sh +++ b/jobd/gc.sh @@ -118,6 +118,7 @@ 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 +# also take this opportunity to optimize the darcs repo if [ ! -e .nofetch ]; then url="$(config_get baseurl || :)" case "$url" in darcs://*) @@ -127,6 +128,13 @@ if [ ! -e .nofetch ]; then tail -n 10000 "$basedarcs.log" > "$basedarcs.log.$$" mv -f "$basedarcs.log.$$" "$basedarcs.log" fi + if [ -d "$basedarcs.darcs" ]; then + ( + cd "$basedarcs.darcs" + # Note that this does not optimize _darcs/inventories/ :( + darcs optimize + ) + fi esac fi config_set lastgc "$(date "$datefmt")" -- 2.11.4.GIT