diff options
author | Junio C Hamano <gitster@pobox.com> | 2013-09-20 12:25:32 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-09-20 12:25:32 -0700 |
commit | 238504b014230d0bc244fb0de84990863fcddd59 (patch) | |
tree | 59fee63d5862631a00b91a9e7045fa5935430dd2 /list-objects.c | |
parent | 79e46c9fed837c565eac8d81448641d6b944a928 (diff) | |
parent | f21d2a786b7fa6e53bb09e6466185b26f7f30d98 (diff) | |
download | git-238504b014230d0bc244fb0de84990863fcddd59.tar.gz |
Merge branch 'nd/fetch-into-shallow'
When there is no sufficient overlap between old and new history
during a fetch into a shallow repository, we unnecessarily sent
objects the sending side knows the receiving end has.
* nd/fetch-into-shallow:
Add testcase for needless objects during a shallow fetch
list-objects: mark more commits as edges in mark_edges_uninteresting
list-objects: reduce one argument in mark_edges_uninteresting
upload-pack: delegate rev walking in shallow fetch to pack-objects
shallow: add setup_temporary_shallow()
shallow: only add shallow graft points to new shallow file
move setup_alternate_shallow and write_shallow_commits to shallow.c
Diffstat (limited to 'list-objects.c')
-rw-r--r-- | list-objects.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/list-objects.c b/list-objects.c index c8c3463cad..6cbedf0280 100644 --- a/list-objects.c +++ b/list-objects.c @@ -144,19 +144,35 @@ static void mark_edge_parents_uninteresting(struct commit *commit, } } -void mark_edges_uninteresting(struct commit_list *list, - struct rev_info *revs, - show_edge_fn show_edge) +void mark_edges_uninteresting(struct rev_info *revs, show_edge_fn show_edge) { - for ( ; list; list = list->next) { + struct commit_list *list; + int i; + + for (list = revs->commits; list; list = list->next) { struct commit *commit = list->item; if (commit->object.flags & UNINTERESTING) { mark_tree_uninteresting(commit->tree); + if (revs->edge_hint && !(commit->object.flags & SHOWN)) { + commit->object.flags |= SHOWN; + show_edge(commit); + } continue; } mark_edge_parents_uninteresting(commit, revs, show_edge); } + for (i = 0; i < revs->cmdline.nr; i++) { + struct object *obj = revs->cmdline.rev[i].item; + struct commit *commit = (struct commit *)obj; + if (obj->type != OBJ_COMMIT || !(obj->flags & UNINTERESTING)) + continue; + mark_tree_uninteresting(commit->tree); + if (revs->edge_hint && !(obj->flags & SHOWN)) { + obj->flags |= SHOWN; + show_edge(commit); + } + } } static void add_pending_tree(struct rev_info *revs, struct tree *tree) |