#!/bin/sh # # Copyright (c) 2006, Shawn O. Pearce # # Cleanup unreachable files and optimize the repository. setglobal USAGE = ''[--prune]'' setglobal SUBDIRECTORY_OK = 'Yes' source git-sh-setup setglobal no_prune = ':' while test $# != 0 { match $1 { with --prune setglobal no_prune = '' with -- usage } shift } match $[git config --get gc.packrefs] { with notbare|"" test $[is_bare_repository] = true || setglobal pack_refs = 'true' with * setglobal pack_refs = $[git config --bool --get gc.packrefs] } test "true" != $pack_refs || git pack-refs --prune && git reflog expire --all && git-repack -a -d -l && $no_prune git prune && git rerere gc || exit