- min_match = NULL;
- for (cur_match = all_matches; cur_match; cur_match = cur_match->next) {
- struct rev_info revs;
- struct commit *tagged = cur_match->name->commit;
-
- clear_commit_marks(cmit, -1);
- init_revisions(&revs, NULL);
- tagged->object.flags |= UNINTERESTING;
- add_pending_object(&revs, &tagged->object, NULL);
- add_pending_object(&revs, &cmit->object, NULL);
-
- prepare_revision_walk(&revs);
- cur_match->depth = 0;
- while ((!min_match || cur_match->depth < min_match->depth)
- && get_revision(&revs))
- cur_match->depth++;
- if (!min_match || (cur_match->depth < min_match->depth
- && cur_match->name->prio >= min_match->name->prio))
- min_match = cur_match;
- free_commit_list(revs.commits);
+ min_match = &all_matches[0];
+ for (cur_match = 1; cur_match < match_cnt; cur_match++) {
+ struct possible_tag *t = &all_matches[cur_match];
+ if (t->depth < min_match->depth
+ && t->name->prio >= min_match->name->prio)
+ min_match = t;
+ }
+ if (debug) {
+ for (cur_match = 0; cur_match < match_cnt; cur_match++) {
+ struct possible_tag *t = &all_matches[cur_match];
+ fprintf(stderr, " %c %8lu %s\n",
+ min_match == t ? '*' : ' ',
+ t->depth, t->name->path);
+ }
+ fprintf(stderr, "traversed %lu commits\n", seen_commits);
+ if (gave_up_on) {
+ fprintf(stderr,
+ "more than %i tags found; listed %i most recent\n"
+ "gave up search at %s\n",
+ max_candidates, max_candidates,
+ sha1_to_hex(gave_up_on->object.sha1));
+ }