diff --git a/builtin/describe.c b/builtin/describe.c index b28a4a1f82..5895d1af3a 100644 --- a/builtin/describe.c +++ b/builtin/describe.c @@ -264,8 +264,10 @@ static unsigned long finish_depth_computation( } if (!a) break; - } else + } else { best->depth++; + fprintf(stderr, "pushing depth of %s (finish_depth_computation): %d\n", oid_to_hex(&c->object.oid), best->depth); + } while (parents) { struct commit *p = parents->item; repo_parse_commit(the_repository, p); @@ -363,19 +365,24 @@ static void describe_commit(struct object_id *oid, struct strbuf *dst) struct commit_list *parents = c->parents; struct commit_name **slot; + fprintf(stderr, "\n\nlooking at commit %s\n", oid_to_hex(&c->object.oid)); seen_commits++; slot = commit_names_peek(&commit_names, c); n = slot ? *slot : NULL; if (n) { if (!tags && !all && n->prio < 2) { + fprintf(stderr, "skipping unannotated tag %s\n", oid_to_hex(&c->object.oid)); unannotated_cnt++; } else if (match_cnt < max_candidates) { struct possible_tag *t = &all_matches[match_cnt++]; t->name = n; t->depth = seen_commits - 1; + fprintf(stderr, "depth of %s: %d\n", oid_to_hex(&c->object.oid), t->depth); t->flag_within = 1u << match_cnt; t->found_order = match_cnt; + fprintf(stderr, "find order of %s: %d\n", oid_to_hex(&c->object.oid), t->found_order); c->object.flags |= t->flag_within; + fprintf(stderr, "setting flag %x for commit %s\n", t->flag_within, oid_to_hex(&c->object.oid)); if (n->prio == 2) annotated_cnt++; } @@ -386,11 +393,15 @@ static void describe_commit(struct object_id *oid, struct strbuf *dst) } for (cur_match = 0; cur_match < match_cnt; cur_match++) { struct possible_tag *t = &all_matches[cur_match]; - if (!(c->object.flags & t->flag_within)) + if (!(c->object.flags & t->flag_within)) { t->depth++; + fprintf(stderr, "flag for %s: %x\n", oid_to_hex(&c->object.oid), c->object.flags); + fprintf(stderr, "pushing depth of %s because of %s (flag_within): %d\n", oid_to_hex(&t->name->peeled), oid_to_hex(&c->object.oid), t->depth); + } } /* Stop if last remaining path already covered by best candidate(s) */ if (annotated_cnt && !list) { + fprintf(stderr, "checking for best candidate\n"); int best_depth = INT_MAX; unsigned best_within = 0; for (cur_match = 0; cur_match < match_cnt; cur_match++) { @@ -415,6 +426,7 @@ static void describe_commit(struct object_id *oid, struct strbuf *dst) if (!(p->object.flags & SEEN)) commit_list_insert_by_date(p, &list); p->object.flags |= c->object.flags; + fprintf(stderr, "setting flag %x for commit %s due to ancestry\n", p->object.flags, oid_to_hex(&p->object.oid)); parents = parents->next; if (first_parent)