diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2014-07-18 16:00:21 +0200 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2014-07-27 17:17:22 +0200 |
commit | 7db0e6ee48fd68009a7e78cbcbca125d6ce9008d (patch) | |
tree | c8d053d8dd5eccf98811ab80a2cc6c6be44a57e7 /tests/revwalk | |
parent | 091165c53b2bcd5d41fb71d43ed5a23a3d96bf5d (diff) | |
download | libgit2-7db0e6ee48fd68009a7e78cbcbca125d6ce9008d.tar.gz |
merge: expose multiple merge basescmn/oidarray
We always calculate multiple merge bases, but up to now we had only
exposed the "best" merge base.
Introduce git_oidarray which analogously to git_strarray lets us return
multiple ids.
Diffstat (limited to 'tests/revwalk')
-rw-r--r-- | tests/revwalk/mergebase.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/revwalk/mergebase.c b/tests/revwalk/mergebase.c index 2c7184fc7..e12e59762 100644 --- a/tests/revwalk/mergebase.c +++ b/tests/revwalk/mergebase.c @@ -135,6 +135,24 @@ void test_revwalk_mergebase__prefer_youngest_merge_base(void) cl_assert_equal_oid(&expected, &result); } +void test_revwalk_mergebase__multiple_merge_bases(void) +{ + git_oid one, two, expected1, expected2; + git_oidarray result = {NULL, 0}; + + cl_git_pass(git_oid_fromstr(&one, "a4a7dce85cf63874e984719f4fdd239f5145052f ")); + cl_git_pass(git_oid_fromstr(&two, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644")); + cl_git_pass(git_oid_fromstr(&expected1, "c47800c7266a2be04c571c04d5a6614691ea99bd")); + cl_git_pass(git_oid_fromstr(&expected2, "9fd738e8f7967c078dceed8190330fc8648ee56a")); + + cl_git_pass(git_merge_bases(&result, _repo, &one, &two)); + cl_assert_equal_i(2, result.count); + cl_assert_equal_oid(&expected1, &result.ids[0]); + cl_assert_equal_oid(&expected2, &result.ids[1]); + + git_oidarray_free(&result); +} + void test_revwalk_mergebase__no_off_by_one_missing(void) { git_oid result, one, two; |