Re: Shallow clone
- From
- Alexandre Julliard <julliard@winehq.org>
- Date
- Nov 11, 2006, 13:57 UTC
- Message-ID
- <87zmaynl18.fsf@wine.dyndns.org>
- In-Reply-To
- <7vac31p8om.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <junkio@cox.net> writes:
Show 6 quoted lines
> But it seems to need some more work. I just tried to clone > git.git with --depth=1 and it cauterizes each branch with two > commits (I think that is what depth=1 means -- the latest and > one behind it), but it pulled almost the whole repository > anyway, and it turns out that "git log v1.4.3-rc1" gives me the > full history leading to it.
That's apparently because tags are not considered when truncating the commit list. The patch below fixes it, and fetches the right number of commits for each tag. However the correct fix is probably to not fetch historical tags at all.
There's also a problem with the packing, a clone --depth 1 currently results in a pack that's about 3 times as large as it should be.
---
diff --git a/shallow.c b/shallow.c index 58a7b20..2db1dc4 100644 --- a/shallow.c +++ b/shallow.c @@ -1,5 +1,6 @@ #include "cache.h" #include "commit.h" +#include "tag.h" static int is_shallow = -1; @@ -54,7 +55,7 @@ struct commit_list *get_shallow_commits( if (!commit) { if (i < heads->nr) { commit = (struct commit *) - heads->objects[i++].item; + deref_tag(heads->objects[i++].item, NULL, 0); if (commit->object.type != OBJ_COMMIT) { commit = NULL; continue;
-- Alexandre Julliard