threads / discuss / 6795

linux-2.6.git/packed-refs???

Subject: linux-2.6.git/packed-refs???

## tl;dr

9 messages between Feb 13, 2007 and Feb 13, 2007.

replies: 8people: 4as markdown or json

Junio C Hamano· Feb 13, 2007, 09:27 UTC · lore

I noticed while scanning #git log that it appears that pack-refs was run in your public repo and some people cannot clone over dumb protocols with older git.

    commit 2986c02217f98809d8990e7679edf0f5d99f904d
    Author: Junio C Hamano <junkio@cox.net>
    Date:   Wed Nov 22 22:24:09 2006 -0800
    git-fetch: fix dumb protocol transport to fetch from pack-pruned ref

was the first revision that aligned dumb protocol clients with pack-ref; unfortunately anything older will not find the ref that was packed.

We do have a backward compatibility warning on this in v1.5.0 release notes draft, but I think we would make it more obvious.

Sigh...
Junio C Hamano· Feb 13, 2007, 09:48 UTC · re: Junio C Hamano · lore

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

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 &&
Johannes Schindelin· Feb 13, 2007, 10:03 UTC · re: Junio C Hamano · lore

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

Hi,
On Tue, 13 Feb 2007, Junio C Hamano wrote:
> Just to be on the safe side, let's not run pack-refs from git-gc
> without an explicit "[gc] packrefs = true" configuration.

It seems to me that the reason are dumb transports, which are very likely to run only from bare repositories. How about checking for a bare repository explicitely, and only if it _is_ bare, check for gc.packrefs, too?

Packed refs _do_ have a tremendous advantage (when you have a lot of tags, like many CVS switchers).

Ciao, Dscho

Jeff King· Feb 13, 2007, 10:29 UTC · re: Johannes Schindelin · lore

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

On Tue, Feb 13, 2007 at 11:03:32AM +0100, Johannes Schindelin wrote:
> It seems to me that the reason are dumb transports, which are very likely 
> to run only from bare repositories. How about checking for a bare 
> repository explicitely, and only if it _is_ bare, check for gc.packrefs, 
> too?

The way you have stated it, I think we will get a lot of "I set gc.packrefs, but it doesn't do anything!" complaints. I think a tri-state "yes/no/notbare" defaulting to "notbare" makes more sense. But maybe you meant the other way around in the first place.

-Peff
Johannes Schindelin· Feb 13, 2007, 10:55 UTC · re: Jeff King · lore

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

Hi,
On Tue, 13 Feb 2007, Jeff King wrote:
Show 11 quoted lines
> On Tue, Feb 13, 2007 at 11:03:32AM +0100, Johannes Schindelin wrote:
> 
> > It seems to me that the reason are dumb transports, which are very 
> > likely to run only from bare repositories. How about checking for a 
> > bare repository explicitely, and only if it _is_ bare, check for 
> > gc.packrefs, too?
> 
> The way you have stated it, I think we will get a lot of "I set 
> gc.packrefs, but it doesn't do anything!" complaints. I think a 
> tri-state "yes/no/notbare" defaulting to "notbare" makes more sense. But 
> maybe you meant the other way around in the first place.

No, I meant it as you understood it. But your solution is evidently way more elegant.

Ciao, Dscho

Johannes Schindelin· Feb 13, 2007, 13:01 UTC · re: Jeff King · lore

[PATCH] 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>
---
	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
Theodore Tso· Feb 13, 2007, 18:16 UTC · re: Junio C Hamano · lore

Re: linux-2.6.git/packed-refs???

On Tue, Feb 13, 2007 at 01:27:03AM -0800, Junio C Hamano wrote:
Show 13 quoted lines
> I noticed while scanning #git log that it appears that pack-refs
> was run in your public repo and some people cannot clone over
> dumb protocols with older git.
> 
>     commit 2986c02217f98809d8990e7679edf0f5d99f904d
>     Author: Junio C Hamano <junkio@cox.net>
>     Date:   Wed Nov 22 22:24:09 2006 -0800
> 
>     git-fetch: fix dumb protocol transport to fetch from pack-pruned ref
> 
> was the first revision that aligned dumb protocol clients with
> pack-ref; unfortunately anything older will not find the ref
> that was packed.

Stupid question. Suppose someone has run git pack-refs on a repository. What is the recommended way to reverse the process. Is the answer is to clone the repository and then throw away the original one? Is there another way to do it?

						- Ted
Johannes Schindelin· Feb 13, 2007, 18:41 UTC · re: Theodore Tso · lore

Re: linux-2.6.git/packed-refs???

Hi,
On Tue, 13 Feb 2007, Theodore Tso wrote:
Show 19 quoted lines
> On Tue, Feb 13, 2007 at 01:27:03AM -0800, Junio C Hamano wrote:
> > I noticed while scanning #git log that it appears that pack-refs
> > was run in your public repo and some people cannot clone over
> > dumb protocols with older git.
> > 
> >     commit 2986c02217f98809d8990e7679edf0f5d99f904d
> >     Author: Junio C Hamano <junkio@cox.net>
> >     Date:   Wed Nov 22 22:24:09 2006 -0800
> > 
> >     git-fetch: fix dumb protocol transport to fetch from pack-pruned ref
> > 
> > was the first revision that aligned dumb protocol clients with
> > pack-ref; unfortunately anything older will not find the ref
> > that was packed.
> 
> Stupid question.  Suppose someone has run git pack-refs on a
> repository.  What is the recommended way to reverse the process.  Is
> the answer is to clone the repository and then throw away the original
> one?  Is there another way to do it?
The easiest way I found here was to do
git-for-each-ref | while read sha1 tag name; do
	git update-ref -m "undo pack-ref" $name $sha1
done
Beware: this is tested once, and copied from memory.

Ciao, Dscho

← back to recent threads