2006-12-27 08:17:59 +01:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Copyright (c) 2006, Shawn O. Pearce
|
|
|
|
#
|
|
|
|
# Cleanup unreachable files and optimize the repository.
|
|
|
|
|
2007-01-22 08:28:28 +01:00
|
|
|
USAGE='git-gc [--prune]'
|
2006-12-27 08:17:59 +01:00
|
|
|
SUBDIRECTORY_OK=Yes
|
|
|
|
. git-sh-setup
|
|
|
|
|
2007-01-22 08:28:28 +01:00
|
|
|
no_prune=:
|
|
|
|
while case $# in 0) break ;; esac
|
|
|
|
do
|
|
|
|
case "$1" in
|
|
|
|
--prune)
|
|
|
|
no_prune=
|
|
|
|
;;
|
|
|
|
--)
|
|
|
|
usage
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
2006-12-27 08:17:59 +01:00
|
|
|
git-pack-refs --prune &&
|
|
|
|
git-reflog expire --all &&
|
2006-12-27 23:23:21 +01:00
|
|
|
git-repack -a -d -l &&
|
2007-01-22 08:28:28 +01:00
|
|
|
$no_prune git-prune &&
|
2006-12-27 08:17:59 +01:00
|
|
|
git-rerere gc || exit
|