* This is a truly stupid algorithm, but it's only * used for bisection, and we just don't care enough. * * We care just barely enough to avoid recursing for * non-merge entries. */
| 43 | * non-merge entries. |
| 44 | */ |
| 45 | static int count_distance(struct commit_list *entry) |
| 46 | { |
| 47 | int nr = 0; |
| 48 | |
| 49 | while (entry) { |
| 50 | struct commit *commit = entry->item; |
| 51 | struct commit_list *p; |
| 52 | |
| 53 | if (commit->object.flags & (UNINTERESTING | COUNTED)) |
| 54 | break; |
| 55 | if (!(commit->object.flags & TREESAME)) |
| 56 | nr++; |
| 57 | commit->object.flags |= COUNTED; |
| 58 | p = commit->parents; |
| 59 | entry = p; |
| 60 | if (p) { |
| 61 | p = p->next; |
| 62 | while (p) { |
| 63 | nr += count_distance(p); |
| 64 | p = p->next; |
| 65 | } |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | return nr; |
| 70 | } |
| 71 | |
| 72 | static void clear_distance(struct commit_list *list) |
| 73 | { |