* Get the next rev to send, ignoring the common. */
| 106 | * Get the next rev to send, ignoring the common. |
| 107 | */ |
| 108 | static const struct object_id *get_rev(struct negotiation_state *ns) |
| 109 | { |
| 110 | struct commit *commit = NULL; |
| 111 | |
| 112 | while (commit == NULL) { |
| 113 | unsigned int mark; |
| 114 | struct commit_list *parents; |
| 115 | |
| 116 | if (ns->rev_list.nr == 0 || ns->non_common_revs == 0) |
| 117 | return NULL; |
| 118 | |
| 119 | commit = prio_queue_get(&ns->rev_list); |
| 120 | repo_parse_commit(the_repository, commit); |
| 121 | parents = commit->parents; |
| 122 | |
| 123 | commit->object.flags |= POPPED; |
| 124 | if (!(commit->object.flags & COMMON)) |
| 125 | ns->non_common_revs--; |
| 126 | |
| 127 | if (commit->object.flags & COMMON) { |
| 128 | /* do not send "have", and ignore ancestors */ |
| 129 | commit = NULL; |
| 130 | mark = COMMON | SEEN; |
| 131 | } else if (commit->object.flags & COMMON_REF) |
| 132 | /* send "have", and ignore ancestors */ |
| 133 | mark = COMMON | SEEN; |
| 134 | else |
| 135 | /* send "have", also for its ancestors */ |
| 136 | mark = SEEN; |
| 137 | |
| 138 | while (parents) { |
| 139 | if (!(parents->item->object.flags & SEEN)) |
| 140 | rev_list_push(ns, parents->item, mark); |
| 141 | if (mark & COMMON) |
| 142 | mark_common(ns, parents->item, 1, 0); |
| 143 | parents = parents->next; |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | return &commit->object.oid; |
| 148 | } |
| 149 | |
| 150 | static void known_common(struct fetch_negotiator *n, struct commit *c) |
| 151 | { |
no test coverage detected