[PATCH] Do not run git-pack-refs by default for now from git-gc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Just to be on the safe side, let's not run pack-refs from git-gc
without an explicit "[gc] packrefs = true" configuration.  This
default should be changed in the future when we can reasonably
assume that everybody runs post v1.5.0-rc0 version of git, at
which time people can still ask it not to run with the same
configuration ("[gc] packrefs = false").

Signed-off-by: Junio C Hamano <junkio@xxxxxxx>
---
diff --git a/Documentation/config.txt b/Documentation/config.txt
index 0129b1f..36b2c4f 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -321,6 +321,16 @@ 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` 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`.  Enable it only when you
+	know you do not have to support such clients.  The
+	default will change to run `git pack-refs` in some
+	future, 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.
diff --git a/Documentation/git-gc.txt b/Documentation/git-gc.txt
index e37758a..ca38c2e 100644
--- a/Documentation/git-gc.txt
+++ b/Documentation/git-gc.txt
@@ -62,9 +62,14 @@ 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 by default to allow older dumb-transport clients
+fetch from the repository,  but this will change in the future.
 
 See Also
 --------
+gitlink:git-pack-refs[1]
 gitlink:git-prune[1]
 gitlink:git-reflog[1]
 gitlink:git-repack[1]
diff --git a/git-gc.sh b/git-gc.sh
index 3e8c87c..054f338 100755
--- a/git-gc.sh
+++ b/git-gc.sh
@@ -22,7 +22,11 @@ do
 	shift
 done
 
-git-pack-refs --prune &&
+if pack_refs=$(git config --bool --get gc.packrefs) &&
+   test "true" = "$pack_refs"
+then
+	git-pack-refs --prune
+fi &&
 git-reflog expire --all &&
 git-repack -a -d -l &&
 $no_prune git-prune &&

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]