git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Herland <johan@herland.net>
To: Daniel Barkalow <barkalow@iabervon.org>
Cc: git@vger.kernel.org
Subject: [PATCH 3/3] Teach "git clone" to pack refs
Date: Sat, 22 Mar 2008 02:13:54 +0100	[thread overview]
Message-ID: <200803220213.54923.johan@herland.net> (raw)
In-Reply-To: <200803220210.30957.johan@herland.net>

In repos with many refs, it is unlikely that most refs will ever change.
This fact is already exploited by "git gc" by executing "git pack-refs"
to consolidate all refs into a single file.

When cloning a repo with many refs, it does not make sense to create the
loose refs in the first place, just to have the next "git gc" consolidate
them into one file. Instead, make "git clone" create the packed refs file
immediately, and forego the loose refs completely.

Signed-off-by: Johan Herland <johan@herland.net>
---
 builtin-clone.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/builtin-clone.c b/builtin-clone.c
index 0a9c873..01c595e 100644
--- a/builtin-clone.c
+++ b/builtin-clone.c
@@ -18,6 +18,7 @@
 #include "transport.h"
 #include "strbuf.h"
 #include "dir.h"
+#include "pack-refs.h"
 
 /*
  * Overall FIXMEs:
@@ -313,8 +314,11 @@ static struct ref *write_remote_refs(const struct ref *refs, struct refspec *ref
 	get_fetch_map(refs, tag_refspec, &tail, 0);
 
 	for (r = local_refs; r; r = r->next)
-		update_ref(reflog,
-			   r->peer_ref->name, r->old_sha1, NULL, 0, DIE_ON_ERR);
+		add_extra_ref(r->peer_ref->name, r->old_sha1, 0);
+
+	pack_refs(PACK_REFS_ALL);
+	clear_extra_refs();
+
 	return local_refs;
 }
 
-- 
1.5.5.rc0.117.ga5237

  parent reply	other threads:[~2008-03-22  1:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-22  1:10 [RFC/PATCH 0/3] Teach builtin-clone to pack refs Johan Herland
2008-03-22  1:12 ` [RFC/PATCH 1/3] Move pack_refs() and friends into libgit Johan Herland
2008-03-22  1:13 ` [RFC/PATCH 2/3] Prepare testsuite for a "git clone" that packs refs Johan Herland
2008-04-14  6:10   ` Daniel Barkalow
2008-04-14  8:00     ` Johan Herland
2008-04-14  8:02       ` [PATCH 1/4] Incorporate fetched packs in future object traversal Johan Herland
2008-04-14  8:02       ` [PATCH 2/4] Move pack_refs() and friends into libgit Johan Herland
2008-04-14  8:03       ` [PATCH 3/4] Prepare testsuite for a "git clone" that packs refs Johan Herland
2008-04-14  8:04       ` [PATCH 4/4] Teach "git clone" to pack refs Johan Herland
2008-03-22  1:13 ` Johan Herland [this message]
2008-03-22  1:31   ` [PATCH 3/3] " Daniel Barkalow
2008-03-23  0:45 ` [RFC/PATCH 0/3] Teach builtin-clone " Junio C Hamano
2008-03-23  9:49   ` Johan Herland

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=200803220213.54923.johan@herland.net \
    --to=johan@herland.net \
    --cc=barkalow@iabervon.org \
    --cc=git@vger.kernel.org \
    /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).