- while (rev1list || rev2list) {
- struct commit *ret;
- if (!rev1list) {
- // process 2
- ret = process_list(&rev2list, 0x2, 0x1);
- } else if (!rev2list) {
- // process 1
- ret = process_list(&rev1list, 0x1, 0x2);
- } else if (rev1list->item->date < rev2list->item->date) {
- // process 2
- ret = process_list(&rev2list, 0x2, 0x1);
- } else {
- // process 1
- ret = process_list(&rev1list, 0x1, 0x2);
+ rev1->object.flags |= 1;
+ rev2->object.flags |= 2;
+ insert_by_date(rev1, &list);
+ insert_by_date(rev2, &list);
+
+ while (list) {
+ struct commit *commit = list->item;
+ struct commit_list *tmp = list, *parents;
+ int flags = commit->object.flags & 3;
+
+ list = list->next;
+ free(tmp);
+ switch (flags) {
+ case 3:
+ insert_by_date(commit, &result);
+ continue;
+ case 0:
+ die("git-merge-base: commit without either parent?");