Re: [PATCH v2 12/21] bisect: replace clear_distance() by unique markers
From: Junio C Hamano <hidden>
Date: 2016-06-16 02:18:49
Stephan Beyer [off-list ref] writes:
quoted hunk
@@ -43,15 +43,17 @@ static int count_distance(struct commit_list *entry) int nr = 0; struct commit_list *todo = NULL; commit_list_append(entry->item, &todo); + marker++; while (todo) { struct commit *commit = pop_commit(&todo); - if (!(commit->object.flags & (UNINTERESTING | COUNTED))) { + if (!(commit->object.flags & UNINTERESTING) + && node_data(commit)->marked != marker) {
Makes sense.
quoted hunk
@@ -123,10 +116,9 @@ static void show_list(const char *debug, int counted, int nr, const char *subject_start; int subject_len; - fprintf(stderr, "%c%c%c ", + fprintf(stderr, "%c%c ", (flags & TREESAME) ? ' ' : 'T', - (flags & UNINTERESTING) ? 'U' : ' ', - (flags & COUNTED) ? 'C' : ' '); + (flags & UNINTERESTING) ? 'U' : ' ');
As this one is for debugging, could we keep the output of 'C'
intact?
It is equivalent to
commit->util && node_data(commit)->marked == marker ? 'C' : ' '
right?
This makes me wonder if node_data(commit) should return NULL instead
of asserting on commit->util in [11/21], by the way. That would
make the above
node_data(commit) && node_data(commit)->marked == marker
? 'C' : ' '
which may be easier to read.
Another small thing I overlooked in [11/21] is that the parameter to
node_data() helper should not be called "elem", which is typically
the name used to point at an element on a linked list structure such
as commit_list. Call it "commit" instead, as that is typically the
way we call a single parameter/variable that appears in a function
that is "struct commit".