git-gc: run pack-refs by default unless the repo is bare
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>
Tue, 13 Feb 2007 13:01:42 +0000 (14:01 +0100)
committerJunio C Hamano <junkio@cox.net>
Tue, 13 Feb 2007 17:19:34 +0000 (09:19 -0800)
The config variable gc.packrefs is tristate now: "true", "false"
and "notbare", where "notbare" is the default.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Documentation/config.txt
Documentation/git-gc.txt
git-gc.sh
index 0129b1fd69ff4b8a82c09b5fc10fb7a999da919f..38655350f22bde08786b4a42e608ba76c1becea4 100644 (file)
@@ -321,6 +321,17 @@ format.headers::
        Additional email headers to include in a patch to be submitted
        by mail.  See gitlink:git-format-patch[1].
 
+gc.packrefs::
+       `git gc` does not run `git pack-refs` in a bare repository by
+       default so that older dumb-transport clients can still fetch
+       from the repository.  Setting this to `true` lets `git
+       gc` to run `git pack-refs`.  Setting this to `false` tells
+       `git gc` never to run `git pack-refs`. The default setting is
+       `notbare`. Enable it only when you know you do not have to
+       support such clients.  The default setting will change to `true`
+       at some stage, and setting this to `false` will continue to
+       prevent `git pack-refs` from being run from `git gc`.
+
 gc.reflogexpire::
        `git reflog expire` removes reflog entries older than
        this time; defaults to 90 days.
index e37758ad15823c81d18ccc06fa4dc8775744cdcd..bc1658434a61bdba41699859f103a3c8e0802d95 100644 (file)
@@ -62,6 +62,10 @@ The optional configuration variable 'gc.rerereunresolved' indicates
 how long records of conflicted merge you have not resolved are
 kept.  This defaults to 15 days.
 
+The optional configuration variable 'gc.packrefs' determines if
+`git gc` runs `git-pack-refs`.  Without the configuration, `git-pack-refs`
+is not run in bare repositories by default, to allow older dumb-transport
+clients fetch from the repository,  but this will change in the future.
 
 See Also
 --------
index 3e8c87c814baaef650484cdd77484858c09e29c4..1a45de5dff7763fbca2a9076a4d3bdb0ed903439 100755 (executable)
--- a/git-gc.sh
+++ b/git-gc.sh
@@ -22,6 +22,14 @@ do
        shift
 done
 
+case "$(git config --get gc.packrefs)" in
+notbare|"")
+       test $(is_bare_repository) = true || pack_refs=true;;
+*)
+       pack_refs=$(git config --bool --get gc.packrefs)
+esac
+
+test "true" != "$pack_refs" ||
 git-pack-refs --prune &&
 git-reflog expire --all &&
 git-repack -a -d -l &&