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

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

 



The config variable gc.packrefs is tristate now: "true", "false"
and "notbare", where "notbare" is the default.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@xxxxxx>

---

	On Tue, 13 Feb 2007, Jeff King wrote:
	
	> I think a tri-state "yes/no/notbare" defaulting to "notbare" 
	> makes more sense.

	This is on top of Junio's patch.

 Documentation/config.txt |   13 +++++++------
 Documentation/git-gc.txt |    4 ++--
 git-gc.sh                |   14 +++++++++-----
 3 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index 36b2c4f..3865535 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -322,13 +322,14 @@ format.headers::
 	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
+	`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`.  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
+	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::
diff --git a/Documentation/git-gc.txt b/Documentation/git-gc.txt
index ca38c2e..910f12a 100644
--- a/Documentation/git-gc.txt
+++ b/Documentation/git-gc.txt
@@ -64,8 +64,8 @@ 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.
+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
 --------
diff --git a/git-gc.sh b/git-gc.sh
index 054f338..1a45de5 100755
--- a/git-gc.sh
+++ b/git-gc.sh
@@ -22,11 +22,15 @@ do
 	shift
 done
 
-if pack_refs=$(git config --bool --get gc.packrefs) &&
-   test "true" = "$pack_refs"
-then
-	git-pack-refs --prune
-fi &&
+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 &&
 $no_prune git-prune &&
-- 
1.5.0.rc4.2434.g472e7

-
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]