diff options
| author | Junio C Hamano <gitster@pobox.com> | 2016-10-18 15:16:34 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2016-10-18 16:03:00 -0700 |
| commit | 2cd944df190f3c5c82461b4859547527376f7aa9 (patch) | |
| tree | b8de323c96c1f2f749ceb2b9c12b5b15d333e47d /commit.c | |
| parent | 01eae6975a8945b4047d6e724ec557b7c0579e24 (diff) | |
| download | git-2cd944df190f3c5c82461b4859547527376f7aa9.tar.gz | |
merge-base: WIP add get_major_merge_base
Diffstat (limited to 'commit.c')
| -rw-r--r-- | commit.c | 25 |
1 files changed, 17 insertions, 8 deletions
@@ -950,7 +950,8 @@ static void mark_redundant(struct commit **array, int cnt) static struct commit_list *get_merge_bases_many_0(struct commit *one, int n, struct commit **twos, - int cleanup) + int cleanup, + int major_only) { struct commit_list *list; struct commit **rslt; @@ -984,10 +985,13 @@ static struct commit_list *get_merge_bases_many_0(struct commit *one, rslt[i++] = list->item; free_commit_list(result); - for (i = 0; i < cnt; i++) - fprintf(stderr, "%c %s\n", - (rslt[i]->object.flags & FPCHAIN) ? '+' : '-', - oid_to_hex(&rslt[i]->object.oid)); + 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)); + } clear_commit_marks(one, all_flags); clear_commit_marks_many(n, twos, all_flags); @@ -1007,19 +1011,24 @@ struct commit_list *get_merge_bases_many(struct commit *one, int n, struct commit **twos) { - return get_merge_bases_many_0(one, n, twos, 1); + return get_merge_bases_many_0(one, n, twos, 1, 0); } struct commit_list *get_merge_bases_many_dirty(struct commit *one, int n, struct commit **twos) { - return get_merge_bases_many_0(one, n, twos, 0); + return get_merge_bases_many_0(one, n, twos, 0, 0); } struct commit_list *get_merge_bases(struct commit *one, struct commit *two) { - return get_merge_bases_many_0(one, 1, &two, 1); + return get_merge_bases_many_0(one, 1, &two, 1, 0); +} + +struct commit_list *get_major_merge_bases(struct commit *one, struct commit *two) +{ + return get_merge_bases_many_0(one, 1, &two, 1, 1); } /* |
