X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=list-objects.c;h=e5c88c278fe23eefbf4cb4dd0c66251b208e48bd;hb=71e55854fd6e5c9ce786bcd20efef43bd56f9df0;hp=adaf9979e643d579488ac71c884a98fa39482ebb;hpb=c64ed70d2557101f2a2c3f76315049d027fe645b;p=git.git diff --git a/list-objects.c b/list-objects.c index adaf9979e..e5c88c278 100644 --- a/list-objects.c +++ b/list-objects.c @@ -25,6 +25,37 @@ static void process_blob(struct rev_info *revs, add_object(obj, p, path, name); } +/* + * Processing a gitlink entry currently does nothing, since + * we do not recurse into the subproject. + * + * We *could* eventually add a flag that actually does that, + * which would involve: + * - is the subproject actually checked out? + * - if so, see if the subproject has already been added + * to the alternates list, and add it if not. + * - process the commit (or tag) the gitlink points to + * recursively. + * + * However, it's unclear whether there is really ever any + * reason to see superprojects and subprojects as such a + * "unified" object pool (potentially resulting in a totally + * humongous pack - avoiding which was the whole point of + * having gitlinks in the first place!). + * + * So for now, there is just a note that we *could* follow + * the link, and how to do it. Whether it necessarily makes + * any sense what-so-ever to ever do that is another issue. + */ +static void process_gitlink(struct rev_info *revs, + const unsigned char *sha1, + struct object_array *p, + struct name_path *path, + const char *name) +{ + /* Nothing to do */ +} + static void process_tree(struct rev_info *revs, struct tree *tree, struct object_array *p, @@ -49,14 +80,16 @@ static void process_tree(struct rev_info *revs, me.elem = name; me.elem_len = strlen(name); - desc.buf = tree->buffer; - desc.size = tree->size; + init_tree_desc(&desc, tree->buffer, tree->size); while (tree_entry(&desc, &entry)) { if (S_ISDIR(entry.mode)) process_tree(revs, lookup_tree(entry.sha1), p, &me, entry.path); + else if (S_ISGITLINK(entry.mode)) + process_gitlink(revs, entry.sha1, + p, &me, entry.path); else process_blob(revs, lookup_blob(entry.sha1), @@ -66,6 +99,39 @@ static void process_tree(struct rev_info *revs, tree->buffer = NULL; } +static void mark_edge_parents_uninteresting(struct commit *commit, + struct rev_info *revs, + show_edge_fn show_edge) +{ + struct commit_list *parents; + + for (parents = commit->parents; parents; parents = parents->next) { + struct commit *parent = parents->item; + if (!(parent->object.flags & UNINTERESTING)) + continue; + mark_tree_uninteresting(parent->tree); + if (revs->edge_hint && !(parent->object.flags & SHOWN)) { + parent->object.flags |= SHOWN; + show_edge(parent); + } + } +} + +void mark_edges_uninteresting(struct commit_list *list, + struct rev_info *revs, + show_edge_fn show_edge) +{ + for ( ; list; list = list->next) { + struct commit *commit = list->item; + + if (commit->object.flags & UNINTERESTING) { + mark_tree_uninteresting(commit->tree); + continue; + } + mark_edge_parents_uninteresting(commit, revs, show_edge); + } +} + void traverse_commit_list(struct rev_info *revs, void (*show_commit)(struct commit *), void (*show_object)(struct object_array_entry *))