@matheusbsbs / matheus-bagliano / commits / c2120e5e4b
Fork 0

git-gc: run pack-refs by default unless the repo is bare

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>

Johannes Schindelin committed Feb 13, 2007 at 14:01 UTC c2120e5e4b9f7c548b0c49f914bc0881d7cece6f
3 files changed +23
Documentation/config.txt
+11
@@ -321,6 +321,17 @@ format.headers::
321 Additional email headers to include in a patch to be submitted
322 by mail. See gitlink:git-format-patch[1].
323
324 +gc.packrefs::
325 + `git gc` does not run `git pack-refs` in a bare repository by
326 + default so that older dumb-transport clients can still fetch
327 + from the repository. Setting this to `true` lets `git
328 + gc` to run `git pack-refs`. Setting this to `false` tells
329 + `git gc` never to run `git pack-refs`. The default setting is
330 + `notbare`. Enable it only when you know you do not have to
331 + support such clients. The default setting will change to `true`
332 + at some stage, and setting this to `false` will continue to
333 + prevent `git pack-refs` from being run from `git gc`.
334 +
335 gc.reflogexpire::
336 `git reflog expire` removes reflog entries older than
337 this time; defaults to 90 days.
Documentation/git-gc.txt
+4
@@ -62,6 +62,10 @@ The optional configuration variable 'gc.rerereunresolved' indicates
62 how long records of conflicted merge you have not resolved are
63 kept. This defaults to 15 days.
64
65 +The optional configuration variable 'gc.packrefs' determines if
66 +`git gc` runs `git-pack-refs`. Without the configuration, `git-pack-refs`
67 +is not run in bare repositories by default, to allow older dumb-transport
68 +clients fetch from the repository, but this will change in the future.
69
70 See Also
71 --------
git-gc.sh
+8
@@ -22,6 +22,14 @@ do
22 shift
23 done
24
25 +case "$(git config --get gc.packrefs)" in
26 +notbare|"")
27 + test $(is_bare_repository) = true || pack_refs=true;;
28 +*)
29 + pack_refs=$(git config --bool --get gc.packrefs)
30 +esac
31 +
32 +test "true" != "$pack_refs" ||
33 git-pack-refs --prune &&
34 git-reflog expire --all &&
35 git-repack -a -d -l &&