@matheusbsbs / matheus-bagliano / commits / 4c0fea0f11
Fork 0

rev-list --boundary: fix re-injecting boundary commits.

Marco reported that $ git rev-list --boundary --topo-order --parents 5aa44d5..ab57c8d misses these two boundary commits. c649657501bada28794a30102d9c13cc28ca0e5e eb38cc689e84a8fd01c1856e889fe8d3b4f1bfb4 Indeed, we can see that gitk shows these two commits at the bottom, because the --boundary code failed to output them. The code did not check to avoid pushing the same uninteresting commit twice to the result list. I am not sure why this fixes the reported problem, but this seems to fix it. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Mar 30, 2006 at 23:59 UTC 4c0fea0f1116a4c782696a3e4cf2db31a4aa8adc
1 file changed +18 -9
revision.c
+18 -9
@@ -420,24 +420,33 @@ static void limit_list(struct rev_info *revs)
420 p = &commit_list_insert(commit, p)->next;
421 }
422 if (revs->boundary) {
423 - list = newlist;
424 - while (list) {
423 + /* mark the ones that are on the result list first */
424 + for (list = newlist; list; list = list->next) {
425 + struct commit *commit = list->item;
426 + commit->object.flags |= TMP_MARK;
427 + }
428 + for (list = newlist; list; list = list->next) {
429 struct commit *commit = list->item;
430 struct object *obj = &commit->object;
427 - struct commit_list *parent = commit->parents;
428 - if (obj->flags & (UNINTERESTING|BOUNDARY)) {
429 - list = list->next;
431 + struct commit_list *parent;
432 + if (obj->flags & UNINTERESTING)
433 continue;
431 - }
432 - while (parent) {
434 + for (parent = commit->parents;
435 + parent;
436 + parent = parent->next) {
437 struct commit *pcommit = parent->item;
434 - parent = parent->next;
438 if (!(pcommit->object.flags & UNINTERESTING))
439 continue;
440 pcommit->object.flags |= BOUNDARY;
441 + if (pcommit->object.flags & TMP_MARK)
442 + continue;
443 + pcommit->object.flags |= TMP_MARK;
444 p = &commit_list_insert(pcommit, p)->next;
445 }
440 - list = list->next;
446 + }
447 + for (list = newlist; list; list = list->next) {
448 + struct commit *commit = list->item;
449 + commit->object.flags &= ~TMP_MARK;
450 }
451 }
452 revs->commits = newlist;