git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Junio C Hamano <junkio@cox.net>, Git Mailing List <git@vger.kernel.org>
Subject: Make "git gc" pack all refs by default
Date: Thu, 24 May 2007 11:41:39 -0700 (PDT)	[thread overview]
Message-ID: <alpine.LFD.0.98.0705241132400.26602@woody.linux-foundation.org> (raw)


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};

             reply	other threads:[~2007-05-24 18:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-24 18:41 Linus Torvalds [this message]
2007-05-24 19:28 ` Make "git gc" pack all refs by default Johannes Schindelin
2007-05-25  2:04 ` Junio C Hamano
2007-05-25  2:20   ` Linus Torvalds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LFD.0.98.0705241132400.26602@woody.linux-foundation.org \
    --to=torvalds@linux-foundation.org \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).