diff options
Diffstat (limited to 'commit.c')
-rw-r--r-- | commit.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -957,6 +957,7 @@ static struct commit_list *get_merge_bases_many_0(struct commit *one, struct commit **rslt; struct commit_list *result; int cnt, i; + char *major; result = merge_bases_many(one, n, twos); @@ -981,16 +982,14 @@ static struct commit_list *get_merge_bases_many_0(struct commit *one, /* There are more than one */ cnt = commit_list_count(result); rslt = xcalloc(cnt, sizeof(*rslt)); + major = xcalloc(cnt, sizeof(*major)); for (list = result, i = 0; list; list = list->next) rslt[i++] = list->item; free_commit_list(result); if (major_only) { - /* debug */ for (i = 0; i < cnt; i++) - fprintf(stderr, "%c %s\n", - (rslt[i]->object.flags & FPCHAIN) ? '+' : '-', - oid_to_hex(&rslt[i]->object.oid)); + major[i] = !!(rslt[i]->object.flags & FPCHAIN); } clear_commit_marks(one, all_flags); @@ -999,11 +998,13 @@ static struct commit_list *get_merge_bases_many_0(struct commit *one, mark_redundant(rslt, cnt); result = NULL; for (i = 0; i < cnt; i++) - if (!(rslt[i]->object.flags & STALE)) + if (!(rslt[i]->object.flags & STALE) && + (!major_only || major[i])) commit_list_insert_by_date(rslt[i], &result); else rslt[i]->object.flags &= ~STALE; free(rslt); + free(major); return result; } |