* Make "git gc" pack all refs by default
@ 2007-05-24 18:41 Linus Torvalds
2007-05-24 19:28 ` Johannes Schindelin
2007-05-25 2:04 ` Junio C Hamano
0 siblings, 2 replies; 4+ messages in thread
From: Linus Torvalds @ 2007-05-24 18:41 UTC (permalink / raw)
To: Junio C Hamano, Git Mailing List
I've taught myself to use "git gc" instead of doing the repack explicitly,
but it doesn't actually do what I think it should do.
We've had packed refs for a long time now, and I think it just makes sense
to pack normal branches too. So I end up having to do
git pack-refs --all --prune
in order to get a nice git repo that doesn't have any unnecessary files.
So why not just do that in "git gc"? It's not as if there really is any
downside to packing branches, even if they end up changing later. Quite
often they don't, and even if they do, so what?
Also, make the default for refs packing just be an unambiguous "do it",
rather than "do it by default only for non-bare repositories". If you want
that behaviour, you can always just add a
[gc]
packrefs = notbare
in your ~/.gitconfig file, but I don't actually see why bare would be any
different (except for the broken reason that http-fetching used to be
totally broken, and not doing it just meant that it didn't even get
fixed in a timely manner!).
So here's a trivial patch to make "git gc" do a better job. Hmm?
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---
Side note: I'd also like to get rid of "info/refs", and just make http
fetching use "packed-refs" instead. That would imply that
"update_server_info()" should do "git pack-refs --all" too! This patch
doesn't do it, though.
builtin-gc.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/builtin-gc.c b/builtin-gc.c
index 8ea165a..45025fb 100644
--- a/builtin-gc.c
+++ b/builtin-gc.c
@@ -17,11 +17,11 @@
static const char builtin_gc_usage[] = "git-gc [--prune] [--aggressive]";
-static int pack_refs = -1;
+static int pack_refs = 1;
static int aggressive_window = -1;
#define MAX_ADD 10
-static const char *argv_pack_refs[] = {"pack-refs", "--prune", NULL};
+static const char *argv_pack_refs[] = {"pack-refs", "--all", "--prune", NULL};
static const char *argv_reflog[] = {"reflog", "expire", "--all", NULL};
static const char *argv_repack[MAX_ADD] = {"repack", "-a", "-d", "-l", NULL};
static const char *argv_prune[] = {"prune", NULL};
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: Make "git gc" pack all refs by default
2007-05-24 18:41 Make "git gc" pack all refs by default Linus Torvalds
@ 2007-05-24 19:28 ` Johannes Schindelin
2007-05-25 2:04 ` Junio C Hamano
1 sibling, 0 replies; 4+ messages in thread
From: Johannes Schindelin @ 2007-05-24 19:28 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Junio C Hamano, Git Mailing List
Hi,
On Thu, 24 May 2007, Linus Torvalds wrote:
> I've taught myself to use "git gc" instead of doing the repack explicitly,
> but it doesn't actually do what I think it should do.
>
> We've had packed refs for a long time now, and I think it just makes sense
> to pack normal branches too.
FWIW I already suggested that:
http://article.gmane.org/gmane.comp.version-control.git/28533
Since there seemed not much interest in that, I let it slip.
Ciao,
Dscho
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Make "git gc" pack all refs by default
2007-05-24 18:41 Make "git gc" pack all refs by default Linus Torvalds
2007-05-24 19:28 ` Johannes Schindelin
@ 2007-05-25 2:04 ` Junio C Hamano
2007-05-25 2:20 ` Linus Torvalds
1 sibling, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2007-05-25 2:04 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Git Mailing List
Linus Torvalds <torvalds@linux-foundation.org> writes:
> Also, make the default for refs packing just be an unambiguous "do it",
> rather than "do it by default only for non-bare repositories". If you want
> that behaviour, you can always just add a
>
> [gc]
> packrefs = notbare
>
> in your ~/.gitconfig file, but I don't actually see why bare would be any
> different (except for the broken reason that http-fetching used to be
> totally broken, and not doing it just meant that it didn't even get
> fixed in a timely manner!).
Boy, you are a lot more aggressive than me.
But the fix was in v1.5.0 and we had two feature releases since
then, so it's a good time to do this. Thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Make "git gc" pack all refs by default
2007-05-25 2:04 ` Junio C Hamano
@ 2007-05-25 2:20 ` Linus Torvalds
0 siblings, 0 replies; 4+ messages in thread
From: Linus Torvalds @ 2007-05-25 2:20 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Git Mailing List
On Thu, 24 May 2007, Junio C Hamano wrote:
>
> Boy, you are a lot more aggressive than me.
Heh.
I don't like the http interfaces, so I have a much easier time saying
"they were broken, deal with it" ;)
I also think that we mis-calculated earlier in assuming that prople don't
have lots of branches, and that packing branches was thus much less
important than packing tags.
It's true that in sane git-only environment, you don't have lots of
branches (fifty isn't "lots"). But when importing things from other
environments, I seem to recall people talking about thousands of branches
(since they cannot be merged and they are project-wide rather than some
local entity, they cannot disappear).
So I think it's better to just pack branches aggressively too, and in
fact, once you do that, and http-fetch knows about it, then that also
means that info/refs becomes pointless, because afaik, it doesn't actually
contain anything more than what a modern "packed-refs" file contains.
So in order to take that _next_ step, we need to encourage people to pack
branches, and then at some point we can hopefully just make http-fetch
start ignoring info/refs..
So yeah, I think being aggressive here is a good idea. I really also
wanted to make update-server-info do the pack-refs thing, but to do it
properly we'd need to make the whole pack-refs thing have a nice library
interface, so it was a much bigger (although probably fairly
straightforward) thing.
Linus
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-05-25 2:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-24 18:41 Make "git gc" pack all refs by default Linus Torvalds
2007-05-24 19:28 ` Johannes Schindelin
2007-05-25 2:04 ` Junio C Hamano
2007-05-25 2:20 ` Linus Torvalds
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).