summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a0022ee)
raw | patch | inline | side by side (parent: a0022ee)
author | Junio C Hamano <junkio@cox.net> | |
Mon, 22 Jan 2007 07:28:28 +0000 (23:28 -0800) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Mon, 22 Jan 2007 07:28:28 +0000 (23:28 -0800) |
git-prune is not safe when run uncontrolled in parallel while
other git operations are creating new objects. To avoid
mistakes, do not run git-prune by default from git-gc.
Signed-off-by: Junio C Hamano <junkio@cox.net>
other git operations are creating new objects. To avoid
mistakes, do not run git-prune by default from git-gc.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Documentation/git-gc.txt | patch | blob | history | |
git-gc.sh | patch | blob | history |
index 2bcc9491a3a985a62d86dc93d83b217f0220e3dc..e37758ad15823c81d18ccc06fa4dc8775744cdcd 100644 (file)
--- a/Documentation/git-gc.txt
+++ b/Documentation/git-gc.txt
SYNOPSIS
--------
-'git-gc'
+'git-gc' [--prune]
DESCRIPTION
-----------
each repository to maintain good disk space utilization and good
operating performance.
+OPTIONS
+-------
+
+--prune::
+ Usually `git-gc` packs refs, expires old reflog entries,
+ packs loose objects,
+ and removes old 'rerere' records. Removal
+ of unreferenced loose objects is an unsafe operation
+ while other git operations are in progress, so it is not
+ done by default. Pass this option if you want it, and only
+ when you know nobody else is creating new objects in the
+ repository at the same time (e.g. never use this option
+ in a cron script).
+
+
Configuration
-------------
diff --git a/git-gc.sh b/git-gc.sh
index 6de55f729258200a0215f65bbacb0a1cf1c0c51f..3e8c87c814baaef650484cdd77484858c09e29c4 100755 (executable)
--- a/git-gc.sh
+++ b/git-gc.sh
#
# Cleanup unreachable files and optimize the repository.
-USAGE=''
+USAGE='git-gc [--prune]'
SUBDIRECTORY_OK=Yes
. git-sh-setup
+no_prune=:
+while case $# in 0) break ;; esac
+do
+ case "$1" in
+ --prune)
+ no_prune=
+ ;;
+ --)
+ usage
+ ;;
+ esac
+ shift
+done
+
git-pack-refs --prune &&
git-reflog expire --all &&
git-repack -a -d -l &&
-git-prune &&
+$no_prune git-prune &&
git-rerere gc || exit