git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Do not fetch tags on new shallow clones
@ 2012-01-04 11:35 Nguyễn Thái Ngọc Duy
  2012-01-04 15:16 ` Shawn Pearce
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2012-01-04 11:35 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

The main purpose of shallow clones is to reduce download. Fetching
tags likely defeats this purpose because old-enough repos tend to have
a lot of tags, spreading across history, which may increase the number
of objects to download significantly.

For example, "git clone --depth=10 git://.../git.git" without changes
fetches ~16M (50k objects). The same command with changes fetches
~6.5M (10k objects).

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 This could also be applied for normal clones. But I don't think
 there are many use cases for it, enough to deserve new --no-tags
 option.

 We should also fetch a single branch, but because branches are
 usually less crowded and stay close the tip, they do not produce too
 many extra objects. Let's leave it until somebody yells up.

 We should also fetch tags that reference to downloaded objects. But I
 don't know how fetch does that magic, so for now users have to do
 "git fetch" after cloning for tags. I have only gone as far as
 fetching tags along by setting TRANS_OPT_FOLLOWTAGS? Help?

 builtin/clone.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/builtin/clone.c b/builtin/clone.c
index 86db954..abd8578 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -428,7 +428,7 @@ static struct ref *wanted_peer_refs(const struct ref *refs,
 	struct ref **tail = head ? &head->next : &local_refs;
 
 	get_fetch_map(refs, refspec, &tail, 0);
-	if (!option_mirror)
+	if (!option_mirror && !option_depth)
 		get_fetch_map(refs, tag_refspec, &tail, 0);
 
 	return local_refs;
-- 
1.7.8.36.g69ee2

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2012-01-07 14:47 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-04 11:35 [PATCH] Do not fetch tags on new shallow clones Nguyễn Thái Ngọc Duy
2012-01-04 15:16 ` Shawn Pearce
2012-01-04 23:59 ` Junio C Hamano
2012-01-05  3:05   ` Shawn Pearce
2012-01-05  5:57     ` Junio C Hamano
2012-01-05 15:16       ` Shawn Pearce
2012-01-05  6:05 ` [PATCH v2] Limit refs to fetch to minimum in " Nguyễn Thái Ngọc Duy
2012-01-05 21:25   ` Junio C Hamano
2012-01-06  7:11   ` [PATCH v3] " Nguyễn Thái Ngọc Duy
2012-01-06 18:40     ` Junio C Hamano
2012-01-07 14:16       ` Nguyen Thai Ngoc Duy
2012-01-07 14:45     ` [PATCH v4] clone: add --single-branch to fetch only one branch Nguyễn Thái Ngọc Duy

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).