git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Feb 13, 2007, 13:01 UTC
Message-ID
<Pine.LNX.4.63.0702131400280.22628@wbgn013.biozentrum.uni-wuerzburg.de>
In-Reply-To
<20070213102951.GA14903@coredump.intra.peff.net>

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>
---
	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
Previous: Junio C HamanoNext: Theodore Tso
Message 7 of 9 in “linux-2.6.git/packed-refs???”
  1. Junio C HamanoFeb 13, 2007
  2. Do not run git-pack-refs by default for now from git-gcJunio C Hamano, Feb 13, 2007
  3. Johannes SchindelinFeb 13, 2007
  4. Jeff KingFeb 13, 2007
  5. Johannes SchindelinFeb 13, 2007
  6. Junio C HamanoFeb 13, 2007
  7. git-gc: run pack-refs by default unless the repo is bareJohannes Schindelin, Feb 13, 2007
  8. Theodore TsoFeb 13, 2007
  9. Johannes SchindelinFeb 13, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.