user-manual: fix rendering of history diagrams
[git/haiku.git] / git-gc.sh
blob436d7caff5c26f7c0ff8c0a410bdabccdec0a900
1 #!/bin/sh
3 # Copyright (c) 2006, Shawn O. Pearce
5 # Cleanup unreachable files and optimize the repository.
7 USAGE='[--prune]'
8 SUBDIRECTORY_OK=Yes
9 . git-sh-setup
11 no_prune=:
12 while case $# in 0) break ;; esac
14 case "$1" in
15 --prune)
16 no_prune=
18 --)
19 usage
21 esac
22 shift
23 done
25 case "$(git config --get gc.packrefs)" in
26 notbare|"")
27 test $(is_bare_repository) = true || pack_refs=true;;
29 pack_refs=$(git config --bool --get gc.packrefs)
30 esac
32 test "true" != "$pack_refs" ||
33 git-pack-refs --prune &&
34 git-reflog expire --all &&
35 git-repack -a -d -l &&
36 $no_prune git-prune &&
37 git-rerere gc || exit