summaryrefslogtreecommitdiff
path: root/commit.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-10-18 15:16:34 -0700
committerJunio C Hamano <gitster@pobox.com>2016-10-18 16:03:00 -0700
commit2cd944df190f3c5c82461b4859547527376f7aa9 (patch)
treeb8de323c96c1f2f749ceb2b9c12b5b15d333e47d /commit.c
parent01eae6975a8945b4047d6e724ec557b7c0579e24 (diff)
downloadgit-2cd944df190f3c5c82461b4859547527376f7aa9.tar.gz
merge-base: WIP add get_major_merge_base
Diffstat (limited to 'commit.c')
-rw-r--r--commit.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/commit.c b/commit.c
index e402cf4ef7..bf2432fae8 100644
--- a/commit.c
+++ b/commit.c
@@ -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);
}
/*