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

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

From
Junio C Hamano <junkio@cox.net>
Date
Feb 13, 2007, 09:48 UTC
Message-ID
<7vzm7iz8uv.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<7v7ium1k7s.fsf@assigned-by-dhcp.cox.net>

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@cox.net>
---
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 &&
Previous: Junio C HamanoNext: Johannes Schindelin
Message 2 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.