|
Packit Service |
20376f |
#include "clar_libgit2.h"
|
|
Packit Service |
20376f |
#include "vector.h"
|
|
Packit Service |
20376f |
#include <stdarg.h>
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
static git_repository *_repo;
|
|
Packit Service |
20376f |
static git_repository *_repo2;
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
void test_revwalk_mergebase__initialize(void)
|
|
Packit Service |
20376f |
{
|
|
Packit Service |
20376f |
cl_git_pass(git_repository_open(&_repo, cl_fixture("testrepo.git")));
|
|
Packit Service |
20376f |
cl_git_pass(git_repository_open(&_repo2, cl_fixture("twowaymerge.git")));
|
|
Packit Service |
20376f |
}
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
void test_revwalk_mergebase__cleanup(void)
|
|
Packit Service |
20376f |
{
|
|
Packit Service |
20376f |
git_repository_free(_repo);
|
|
Packit Service |
20376f |
_repo = NULL;
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
git_repository_free(_repo2);
|
|
Packit Service |
20376f |
_repo2 = NULL;
|
|
Packit Service |
20376f |
}
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
void test_revwalk_mergebase__single1(void)
|
|
Packit Service |
20376f |
{
|
|
Packit Service |
20376f |
git_oid result, one, two, expected;
|
|
Packit Service |
20376f |
size_t ahead, behind;
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
cl_git_pass(git_oid_fromstr(&one, "c47800c7266a2be04c571c04d5a6614691ea99bd "));
|
|
Packit Service |
20376f |
cl_git_pass(git_oid_fromstr(&two, "9fd738e8f7967c078dceed8190330fc8648ee56a"));
|
|
Packit Service |
20376f |
cl_git_pass(git_oid_fromstr(&expected, "5b5b025afb0b4c913b4c338a42934a3863bf3644"));
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
cl_git_pass(git_merge_base(&result, _repo, &one, &two);;
|
|
Packit Service |
20376f |
cl_assert_equal_oid(&expected, &result);
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
cl_git_pass(git_graph_ahead_behind(&ahead, &behind, _repo, &one, &two);;
|
|
Packit Service |
20376f |
cl_assert_equal_sz(ahead, 1);
|
|
Packit Service |
20376f |
cl_assert_equal_sz(behind, 2);
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
cl_git_pass(git_graph_ahead_behind(&ahead, &behind, _repo, &two, &one));
|
|
Packit Service |
20376f |
cl_assert_equal_sz(ahead, 2);
|
|
Packit Service |
20376f |
cl_assert_equal_sz(behind, 1);
|
|
Packit Service |
20376f |
}
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
void test_revwalk_mergebase__single2(void)
|
|
Packit Service |
20376f |
{
|
|
Packit Service |
20376f |
git_oid result, one, two, expected;
|
|
Packit Service |
20376f |
size_t ahead, behind;
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
cl_git_pass(git_oid_fromstr(&one, "763d71aadf09a7951596c9746c024e7eece7c7af"));
|
|
Packit Service |
20376f |
cl_git_pass(git_oid_fromstr(&two, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750"));
|
|
Packit Service |
20376f |
cl_git_pass(git_oid_fromstr(&expected, "c47800c7266a2be04c571c04d5a6614691ea99bd"));
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
cl_git_pass(git_merge_base(&result, _repo, &one, &two);;
|
|
Packit Service |
20376f |
cl_assert_equal_oid(&expected, &result);
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
cl_git_pass(git_graph_ahead_behind( &ahead, &behind, _repo, &one, &two);;
|
|
Packit Service |
20376f |
cl_assert_equal_sz(ahead, 1);
|
|
Packit Service |
20376f |
cl_assert_equal_sz(behind, 4);
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
cl_git_pass(git_graph_ahead_behind( &ahead, &behind, _repo, &two, &one));
|
|
Packit Service |
20376f |
cl_assert_equal_sz(ahead, 4);
|
|
Packit Service |
20376f |
cl_assert_equal_sz(behind, 1);
|
|
Packit Service |
20376f |
}
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
void test_revwalk_mergebase__merged_branch(void)
|
|
Packit Service |
20376f |
{
|
|
Packit Service |
20376f |
git_oid result, one, two, expected;
|
|
Packit Service |
20376f |
size_t ahead, behind;
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
cl_git_pass(git_oid_fromstr(&one, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750"));
|
|
Packit Service |
20376f |
cl_git_pass(git_oid_fromstr(&two, "9fd738e8f7967c078dceed8190330fc8648ee56a"));
|
|
Packit Service |
20376f |
cl_git_pass(git_oid_fromstr(&expected, "9fd738e8f7967c078dceed8190330fc8648ee56a"));
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
cl_git_pass(git_merge_base(&result, _repo, &one, &two);;
|
|
Packit Service |
20376f |
cl_assert_equal_oid(&expected, &result);
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
cl_git_pass(git_merge_base(&result, _repo, &two, &one));
|
|
Packit Service |
20376f |
cl_assert_equal_oid(&expected, &result);
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
cl_git_pass(git_graph_ahead_behind(&ahead, &behind, _repo, &one, &two);;
|
|
Packit Service |
20376f |
cl_assert_equal_sz(ahead, 3);
|
|
Packit Service |
20376f |
cl_assert_equal_sz(behind, 0);
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
cl_git_pass(git_graph_ahead_behind(&ahead, &behind, _repo, &two, &one));
|
|
Packit Service |
20376f |
cl_assert_equal_sz(ahead, 0);
|
|
Packit Service |
20376f |
cl_assert_equal_sz(behind, 3);
|
|
Packit Service |
20376f |
}
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
void test_revwalk_mergebase__two_way_merge(void)
|
|
Packit Service |
20376f |
{
|
|
Packit Service |
20376f |
git_oid one, two;
|
|
Packit Service |
20376f |
size_t ahead, behind;
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
cl_git_pass(git_oid_fromstr(&one, "9b219343610c88a1187c996d0dc58330b55cee28"));
|
|
Packit Service |
20376f |
cl_git_pass(git_oid_fromstr(&two, "a953a018c5b10b20c86e69fef55ebc8ad4c5a417"));
|
|
Packit Service |
20376f |
cl_git_pass(git_graph_ahead_behind(&ahead, &behind, _repo2, &one, &two);;
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
cl_assert_equal_sz(ahead, 8);
|
|
Packit Service |
20376f |
cl_assert_equal_sz(behind, 2);
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
cl_git_pass(git_graph_ahead_behind(&ahead, &behind, _repo2, &two, &one));
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
cl_assert_equal_sz(ahead, 2);
|
|
Packit Service |
20376f |
cl_assert_equal_sz(behind, 8);
|
|
Packit Service |
20376f |
}
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
void test_revwalk_mergebase__no_common_ancestor_returns_ENOTFOUND(void)
|
|
Packit Service |
20376f |
{
|
|
Packit Service |
20376f |
git_oid result, one, two;
|
|
Packit Service |
20376f |
size_t ahead, behind;
|
|
Packit Service |
20376f |
int error;
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
cl_git_pass(git_oid_fromstr(&one, "763d71aadf09a7951596c9746c024e7eece7c7af"));
|
|
Packit Service |
20376f |
cl_git_pass(git_oid_fromstr(&two, "e90810b8df3e80c413d903f631643c716887138d"));
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
error = git_merge_base(&result, _repo, &one, &two);
|
|
Packit Service |
20376f |
cl_git_fail(error);
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
cl_assert_equal_i(GIT_ENOTFOUND, error);
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
cl_git_pass(git_graph_ahead_behind(&ahead, &behind, _repo, &one, &two);;
|
|
Packit Service |
20376f |
cl_assert_equal_sz(4, ahead);
|
|
Packit Service |
20376f |
cl_assert_equal_sz(2, behind);
|
|
Packit Service |
20376f |
}
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
void test_revwalk_mergebase__prefer_youngest_merge_base(void)
|
|
Packit Service |
20376f |
{
|
|
Packit Service |
20376f |
git_oid result, one, two, expected;
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
cl_git_pass(git_oid_fromstr(&one, "a4a7dce85cf63874e984719f4fdd239f5145052f"));
|
|
Packit Service |
20376f |
cl_git_pass(git_oid_fromstr(&two, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644"));
|
|
Packit Service |
20376f |
cl_git_pass(git_oid_fromstr(&expected, "c47800c7266a2be04c571c04d5a6614691ea99bd"));
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
cl_git_pass(git_merge_base(&result, _repo, &one, &two);;
|
|
Packit Service |
20376f |
cl_assert_equal_oid(&expected, &result);
|
|
Packit Service |
20376f |
}
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
void test_revwalk_mergebase__multiple_merge_bases(void)
|
|
Packit Service |
20376f |
{
|
|
Packit Service |
20376f |
git_oid one, two, expected1, expected2;
|
|
Packit Service |
20376f |
git_oidarray result = {NULL, 0};
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
cl_git_pass(git_oid_fromstr(&one, "a4a7dce85cf63874e984719f4fdd239f5145052f"));
|
|
Packit Service |
20376f |
cl_git_pass(git_oid_fromstr(&two, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644"));
|
|
Packit Service |
20376f |
cl_git_pass(git_oid_fromstr(&expected1, "c47800c7266a2be04c571c04d5a6614691ea99bd"));
|
|
Packit Service |
20376f |
cl_git_pass(git_oid_fromstr(&expected2, "9fd738e8f7967c078dceed8190330fc8648ee56a"));
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
cl_git_pass(git_merge_bases(&result, _repo, &one, &two);;
|
|
Packit Service |
20376f |
cl_assert_equal_i(2, result.count);
|
|
Packit Service |
20376f |
cl_assert_equal_oid(&expected1, &result.ids[0]);
|
|
Packit Service |
20376f |
cl_assert_equal_oid(&expected2, &result.ids[1]);
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
git_oidarray_free(&result);
|
|
Packit Service |
20376f |
}
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
void test_revwalk_mergebase__multiple_merge_bases_many_commits(void)
|
|
Packit Service |
20376f |
{
|
|
Packit Service |
20376f |
git_oid expected1, expected2;
|
|
Packit Service |
20376f |
git_oidarray result = {NULL, 0};
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
git_oid *input = git__malloc(sizeof(git_oid) * 2);
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
cl_git_pass(git_oid_fromstr(&input[0], "a4a7dce85cf63874e984719f4fdd239f5145052f"));
|
|
Packit Service |
20376f |
cl_git_pass(git_oid_fromstr(&input[1], "be3563ae3f795b2b4353bcce3a527ad0a4f7f644"));
|
|
Packit Service |
20376f |
cl_git_pass(git_oid_fromstr(&expected1, "c47800c7266a2be04c571c04d5a6614691ea99bd"));
|
|
Packit Service |
20376f |
cl_git_pass(git_oid_fromstr(&expected2, "9fd738e8f7967c078dceed8190330fc8648ee56a"));
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
cl_git_pass(git_merge_bases_many(&result, _repo, 2, input));
|
|
Packit Service |
20376f |
cl_assert_equal_i(2, result.count);
|
|
Packit Service |
20376f |
cl_assert_equal_oid(&expected1, &result.ids[0]);
|
|
Packit Service |
20376f |
cl_assert_equal_oid(&expected2, &result.ids[1]);
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
git_oidarray_free(&result);
|
|
Packit Service |
20376f |
git__free(input);
|
|
Packit Service |
20376f |
}
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
void test_revwalk_mergebase__no_off_by_one_missing(void)
|
|
Packit Service |
20376f |
{
|
|
Packit Service |
20376f |
git_oid result, one, two;
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
cl_git_pass(git_oid_fromstr(&one, "1a443023183e3f2bfbef8ac923cd81c1018a18fd"));
|
|
Packit Service |
20376f |
cl_git_pass(git_oid_fromstr(&two, "9f13f7d0a9402c681f91dc590cf7b5470e6a77d2"));
|
|
Packit Service |
20376f |
cl_git_pass(git_merge_base(&result, _repo, &one, &two);;
|
|
Packit Service |
20376f |
}
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
static void assert_mergebase_many(const char *expected_sha, int count, ...)
|
|
Packit Service |
20376f |
{
|
|
Packit Service |
20376f |
va_list ap;
|
|
Packit Service |
20376f |
int i;
|
|
Packit Service |
20376f |
git_oid *oids;
|
|
Packit Service |
20376f |
git_oid oid, expected;
|
|
Packit Service |
20376f |
char *partial_oid;
|
|
Packit Service |
20376f |
git_object *object;
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
oids = git__malloc(count * sizeof(git_oid));
|
|
Packit Service |
20376f |
cl_assert(oids != NULL);
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
memset(oids, 0x0, count * sizeof(git_oid));
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
va_start(ap, count);
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
for (i = 0; i < count; ++i) {
|
|
Packit Service |
20376f |
partial_oid = va_arg(ap, char *);
|
|
Packit Service |
20376f |
cl_git_pass(git_oid_fromstrn(&oid, partial_oid, strlen(partial_oid)));
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
cl_git_pass(git_object_lookup_prefix(&object, _repo, &oid, strlen(partial_oid), GIT_OBJ_COMMIT));
|
|
Packit Service |
20376f |
git_oid_cpy(&oids[i], git_object_id(object));
|
|
Packit Service |
20376f |
git_object_free(object);
|
|
Packit Service |
20376f |
}
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
va_end(ap);
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
if (expected_sha == NULL)
|
|
Packit Service |
20376f |
cl_assert_equal_i(GIT_ENOTFOUND, git_merge_base_many(&oid, _repo, count, oids));
|
|
Packit Service |
20376f |
else {
|
|
Packit Service |
20376f |
cl_git_pass(git_merge_base_many(&oid, _repo, count, oids));
|
|
Packit Service |
20376f |
cl_git_pass(git_oid_fromstr(&expected, expected_sha));
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
cl_assert_equal_oid(&expected, &oid;;
|
|
Packit Service |
20376f |
}
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
git__free(oids);
|
|
Packit Service |
20376f |
}
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
void test_revwalk_mergebase__many_no_common_ancestor_returns_ENOTFOUND(void)
|
|
Packit Service |
20376f |
{
|
|
Packit Service |
20376f |
assert_mergebase_many(NULL, 3, "41bc8c", "e90810", "a65fed");
|
|
Packit Service |
20376f |
assert_mergebase_many(NULL, 3, "e90810", "41bc8c", "a65fed");
|
|
Packit Service |
20376f |
assert_mergebase_many(NULL, 3, "e90810", "a65fed", "41bc8c");
|
|
Packit Service |
20376f |
assert_mergebase_many(NULL, 3, "a65fed", "e90810", "41bc8c");
|
|
Packit Service |
20376f |
assert_mergebase_many(NULL, 3, "a65fed", "41bc8c", "e90810");
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
assert_mergebase_many(NULL, 3, "e90810", "763d71", "a65fed");
|
|
Packit Service |
20376f |
}
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
void test_revwalk_mergebase__many_merge_branch(void)
|
|
Packit Service |
20376f |
{
|
|
Packit Service |
20376f |
assert_mergebase_many("c47800c7266a2be04c571c04d5a6614691ea99bd", 3, "a65fed", "763d71", "849607");
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
assert_mergebase_many("c47800c7266a2be04c571c04d5a6614691ea99bd", 3, "763d71", "e90810", "a65fed");
|
|
Packit Service |
20376f |
assert_mergebase_many("c47800c7266a2be04c571c04d5a6614691ea99bd", 3, "763d71", "a65fed", "e90810");
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
assert_mergebase_many("c47800c7266a2be04c571c04d5a6614691ea99bd", 3, "a65fed", "763d71", "849607");
|
|
Packit Service |
20376f |
assert_mergebase_many("c47800c7266a2be04c571c04d5a6614691ea99bd", 3, "a65fed", "849607", "763d71");
|
|
Packit Service |
20376f |
assert_mergebase_many("8496071c1b46c854b31185ea97743be6a8774479", 3, "849607", "a65fed", "763d71");
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
assert_mergebase_many("5b5b025afb0b4c913b4c338a42934a3863bf3644", 5, "5b5b02", "763d71", "a4a7dc", "a65fed", "41bc8c");
|
|
Packit Service |
20376f |
}
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
static void assert_mergebase_octopus(const char *expected_sha, int count, ...)
|
|
Packit Service |
20376f |
{
|
|
Packit Service |
20376f |
va_list ap;
|
|
Packit Service |
20376f |
int i;
|
|
Packit Service |
20376f |
git_oid *oids;
|
|
Packit Service |
20376f |
git_oid oid, expected;
|
|
Packit Service |
20376f |
char *partial_oid;
|
|
Packit Service |
20376f |
git_object *object;
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
oids = git__malloc(count * sizeof(git_oid));
|
|
Packit Service |
20376f |
cl_assert(oids != NULL);
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
memset(oids, 0x0, count * sizeof(git_oid));
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
va_start(ap, count);
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
for (i = 0; i < count; ++i) {
|
|
Packit Service |
20376f |
partial_oid = va_arg(ap, char *);
|
|
Packit Service |
20376f |
cl_git_pass(git_oid_fromstrn(&oid, partial_oid, strlen(partial_oid)));
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
cl_git_pass(git_object_lookup_prefix(&object, _repo, &oid, strlen(partial_oid), GIT_OBJ_COMMIT));
|
|
Packit Service |
20376f |
git_oid_cpy(&oids[i], git_object_id(object));
|
|
Packit Service |
20376f |
git_object_free(object);
|
|
Packit Service |
20376f |
}
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
va_end(ap);
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
if (expected_sha == NULL)
|
|
Packit Service |
20376f |
cl_assert_equal_i(GIT_ENOTFOUND, git_merge_base_octopus(&oid, _repo, count, oids));
|
|
Packit Service |
20376f |
else {
|
|
Packit Service |
20376f |
cl_git_pass(git_merge_base_octopus(&oid, _repo, count, oids));
|
|
Packit Service |
20376f |
cl_git_pass(git_oid_fromstr(&expected, expected_sha));
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
cl_assert_equal_oid(&expected, &oid;;
|
|
Packit Service |
20376f |
}
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
git__free(oids);
|
|
Packit Service |
20376f |
}
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
void test_revwalk_mergebase__octopus_no_common_ancestor_returns_ENOTFOUND(void)
|
|
Packit Service |
20376f |
{
|
|
Packit Service |
20376f |
assert_mergebase_octopus(NULL, 3, "41bc8c", "e90810", "a65fed");
|
|
Packit Service |
20376f |
assert_mergebase_octopus(NULL, 3, "e90810", "41bc8c", "a65fed");
|
|
Packit Service |
20376f |
assert_mergebase_octopus(NULL, 3, "e90810", "a65fed", "41bc8c");
|
|
Packit Service |
20376f |
assert_mergebase_octopus(NULL, 3, "a65fed", "e90810", "41bc8c");
|
|
Packit Service |
20376f |
assert_mergebase_octopus(NULL, 3, "a65fed", "41bc8c", "e90810");
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
assert_mergebase_octopus(NULL, 3, "e90810", "763d71", "a65fed");
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
assert_mergebase_octopus(NULL, 3, "763d71", "e90810", "a65fed");
|
|
Packit Service |
20376f |
assert_mergebase_octopus(NULL, 3, "763d71", "a65fed", "e90810");
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
assert_mergebase_octopus(NULL, 5, "5b5b02", "763d71", "a4a7dc", "a65fed", "41bc8c");
|
|
Packit Service |
20376f |
}
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
void test_revwalk_mergebase__octopus_merge_branch(void)
|
|
Packit Service |
20376f |
{
|
|
Packit Service |
20376f |
assert_mergebase_octopus("8496071c1b46c854b31185ea97743be6a8774479", 3, "a65fed", "763d71", "849607");
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
assert_mergebase_octopus("8496071c1b46c854b31185ea97743be6a8774479", 3, "a65fed", "763d71", "849607");
|
|
Packit Service |
20376f |
assert_mergebase_octopus("8496071c1b46c854b31185ea97743be6a8774479", 3, "a65fed", "849607", "763d71");
|
|
Packit Service |
20376f |
assert_mergebase_octopus("8496071c1b46c854b31185ea97743be6a8774479", 3, "849607", "a65fed", "763d71");
|
|
Packit Service |
20376f |
}
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
/*
|
|
Packit Service |
20376f |
* testrepo.git $ git log --graph --all
|
|
Packit Service |
20376f |
* * commit 763d71aadf09a7951596c9746c024e7eece7c7af
|
|
Packit Service |
20376f |
* | Author: nulltoken <emeric.fermas@gmail.com>
|
|
Packit Service |
20376f |
* | Date: Sun Oct 9 12:54:47 2011 +0200
|
|
Packit Service |
20376f |
* |
|
|
Packit Service |
20376f |
* | Add some files into subdirectories
|
|
Packit Service |
20376f |
* |
|
|
Packit Service |
20376f |
* | * commit a65fedf39aefe402d3bb6e24df4d4f5fe4547750
|
|
Packit Service |
20376f |
* | | Author: Scott Chacon <schacon@gmail.com>
|
|
Packit Service |
20376f |
* | | Date: Tue Aug 9 19:33:46 2011 -0700
|
|
Packit Service |
20376f |
* | |
|
|
Packit Service |
20376f |
* | * commit be3563ae3f795b2b4353bcce3a527ad0a4f7f644
|
|
Packit Service |
20376f |
* | |\ Merge: 9fd738e c47800c
|
|
Packit Service |
20376f |
* | |/ Author: Scott Chacon <schacon@gmail.com>
|
|
Packit Service |
20376f |
* |/| Date: Tue May 25 11:58:27 2010 -0700
|
|
Packit Service |
20376f |
* | |
|
|
Packit Service |
20376f |
* | | Merge branch 'br2'
|
|
Packit Service |
20376f |
* | |
|
|
Packit Service |
20376f |
* | | * commit e90810b8df3e80c413d903f631643c716887138d
|
|
Packit Service |
20376f |
* | | | Author: Vicent Marti <tanoku@gmail.com>
|
|
Packit Service |
20376f |
* | | | Date: Thu Aug 5 18:42:20 2010 +0200
|
|
Packit Service |
20376f |
* | | |
|
|
Packit Service |
20376f |
* | | | Test commit 2
|
|
Packit Service |
20376f |
* | | |
|
|
Packit Service |
20376f |
* | | * commit 6dcf9bf7541ee10456529833502442f385010c3d
|
|
Packit Service |
20376f |
* | | Author: Vicent Marti <tanoku@gmail.com>
|
|
Packit Service |
20376f |
* | | Date: Thu Aug 5 18:41:33 2010 +0200
|
|
Packit Service |
20376f |
* | |
|
|
Packit Service |
20376f |
* | | Test commit 1
|
|
Packit Service |
20376f |
* | |
|
|
Packit Service |
20376f |
* | | * commit a4a7dce85cf63874e984719f4fdd239f5145052f
|
|
Packit Service |
20376f |
* | | |\ Merge: c47800c 9fd738e
|
|
Packit Service |
20376f |
* | |/ / Author: Scott Chacon <schacon@gmail.com>
|
|
Packit Service |
20376f |
* |/| / Date: Tue May 25 12:00:23 2010 -0700
|
|
Packit Service |
20376f |
* | |/
|
|
Packit Service |
20376f |
* | | Merge branch 'master' into br2
|
|
Packit Service |
20376f |
* | |
|
|
Packit Service |
20376f |
* | * commit 9fd738e8f7967c078dceed8190330fc8648ee56a
|
|
Packit Service |
20376f |
* | | Author: Scott Chacon <schacon@gmail.com>
|
|
Packit Service |
20376f |
* | | Date: Mon May 24 10:19:19 2010 -0700
|
|
Packit Service |
20376f |
* | |
|
|
Packit Service |
20376f |
* | | a fourth commit
|
|
Packit Service |
20376f |
* | |
|
|
Packit Service |
20376f |
* | * commit 4a202b346bb0fb0db7eff3cffeb3c70babbd2045
|
|
Packit Service |
20376f |
* | | Author: Scott Chacon <schacon@gmail.com>
|
|
Packit Service |
20376f |
* | | Date: Mon May 24 10:19:04 2010 -0700
|
|
Packit Service |
20376f |
* | |
|
|
Packit Service |
20376f |
* | | a third commit
|
|
Packit Service |
20376f |
* | |
|
|
Packit Service |
20376f |
* * | commit c47800c7266a2be04c571c04d5a6614691ea99bd
|
|
Packit Service |
20376f |
* |/ Author: Scott Chacon <schacon@gmail.com>
|
|
Packit Service |
20376f |
* | Date: Tue May 25 11:58:14 2010 -0700
|
|
Packit Service |
20376f |
* |
|
|
Packit Service |
20376f |
* | branch commit one
|
|
Packit Service |
20376f |
* |
|
|
Packit Service |
20376f |
* * commit 5b5b025afb0b4c913b4c338a42934a3863bf3644
|
|
Packit Service |
20376f |
* | Author: Scott Chacon <schacon@gmail.com>
|
|
Packit Service |
20376f |
* | Date: Tue May 11 13:38:42 2010 -0700
|
|
Packit Service |
20376f |
* |
|
|
Packit Service |
20376f |
* | another commit
|
|
Packit Service |
20376f |
* |
|
|
Packit Service |
20376f |
* * commit 8496071c1b46c854b31185ea97743be6a8774479
|
|
Packit Service |
20376f |
* Author: Scott Chacon <schacon@gmail.com>
|
|
Packit Service |
20376f |
* Date: Sat May 8 16:13:06 2010 -0700
|
|
Packit Service |
20376f |
*
|
|
Packit Service |
20376f |
* testing
|
|
Packit Service |
20376f |
*
|
|
Packit Service |
20376f |
* * commit 41bc8c69075bbdb46c5c6f0566cc8cc5b46e8bd9
|
|
Packit Service |
20376f |
* | Author: Scott Chacon <schacon@gmail.com>
|
|
Packit Service |
20376f |
* | Date: Tue May 11 13:40:41 2010 -0700
|
|
Packit Service |
20376f |
* |
|
|
Packit Service |
20376f |
* | packed commit two
|
|
Packit Service |
20376f |
* |
|
|
Packit Service |
20376f |
* * commit 5001298e0c09ad9c34e4249bc5801c75e9754fa5
|
|
Packit Service |
20376f |
* Author: Scott Chacon <schacon@gmail.com>
|
|
Packit Service |
20376f |
* Date: Tue May 11 13:40:23 2010 -0700
|
|
Packit Service |
20376f |
*
|
|
Packit Service |
20376f |
* packed commit one
|
|
Packit Service |
20376f |
*/
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
/*
|
|
Packit Service |
20376f |
* twowaymerge.git $ git log --graph --all
|
|
Packit Service |
20376f |
* * commit 9b219343610c88a1187c996d0dc58330b55cee28
|
|
Packit Service |
20376f |
* |\ Merge: c37a783 2224e19
|
|
Packit Service |
20376f |
* | | Author: Scott J. Goldman <scottjg@github.com>
|
|
Packit Service |
20376f |
* | | Date: Tue Nov 27 20:31:04 2012 -0800
|
|
Packit Service |
20376f |
* | |
|
|
Packit Service |
20376f |
* | | Merge branch 'first-branch' into second-branch
|
|
Packit Service |
20376f |
* | |
|
|
Packit Service |
20376f |
* | * commit 2224e191514cb4bd8c566d80dac22dfcb1e9bb83
|
|
Packit Service |
20376f |
* | | Author: Scott J. Goldman <scottjg@github.com>
|
|
Packit Service |
20376f |
* | | Date: Tue Nov 27 20:28:51 2012 -0800
|
|
Packit Service |
20376f |
* | |
|
|
Packit Service |
20376f |
* | | j
|
|
Packit Service |
20376f |
* | |
|
|
Packit Service |
20376f |
* | * commit a41a49f8f5cd9b6cb14a076bf8394881ed0b4d19
|
|
Packit Service |
20376f |
* | | Author: Scott J. Goldman <scottjg@github.com>
|
|
Packit Service |
20376f |
* | | Date: Tue Nov 27 20:28:39 2012 -0800
|
|
Packit Service |
20376f |
* | |
|
|
Packit Service |
20376f |
* | | i
|
|
Packit Service |
20376f |
* | |
|
|
Packit Service |
20376f |
* | * commit 82bf9a1a10a4b25c1f14c9607b60970705e92545
|
|
Packit Service |
20376f |
* | | Author: Scott J. Goldman <scottjg@github.com>
|
|
Packit Service |
20376f |
* | | Date: Tue Nov 27 20:28:28 2012 -0800
|
|
Packit Service |
20376f |
* | |
|
|
Packit Service |
20376f |
* | | h
|
|
Packit Service |
20376f |
* | |
|
|
Packit Service |
20376f |
* * | commit c37a783c20d92ac92362a78a32860f7eebf938ef
|
|
Packit Service |
20376f |
* | | Author: Scott J. Goldman <scottjg@github.com>
|
|
Packit Service |
20376f |
* | | Date: Tue Nov 27 20:30:57 2012 -0800
|
|
Packit Service |
20376f |
* | |
|
|
Packit Service |
20376f |
* | | n
|
|
Packit Service |
20376f |
* | |
|
|
Packit Service |
20376f |
* * | commit 8b82fb1794cb1c8c7f172ec730a4c2db0ae3e650
|
|
Packit Service |
20376f |
* | | Author: Scott J. Goldman <scottjg@github.com>
|
|
Packit Service |
20376f |
* | | Date: Tue Nov 27 20:30:43 2012 -0800
|
|
Packit Service |
20376f |
* | |
|
|
Packit Service |
20376f |
* | | m
|
|
Packit Service |
20376f |
* | |
|
|
Packit Service |
20376f |
* * | commit 6ab5d28acbf3c3bdff276f7ccfdf29c1520e542f
|
|
Packit Service |
20376f |
* | | Author: Scott J. Goldman <scottjg@github.com>
|
|
Packit Service |
20376f |
* | | Date: Tue Nov 27 20:30:38 2012 -0800
|
|
Packit Service |
20376f |
* | |
|
|
Packit Service |
20376f |
* | | l
|
|
Packit Service |
20376f |
* | |
|
|
Packit Service |
20376f |
* * | commit 7b8c336c45fc6895c1c60827260fe5d798e5d247
|
|
Packit Service |
20376f |
* | | Author: Scott J. Goldman <scottjg@github.com>
|
|
Packit Service |
20376f |
* | | Date: Tue Nov 27 20:30:24 2012 -0800
|
|
Packit Service |
20376f |
* | |
|
|
Packit Service |
20376f |
* | | k
|
|
Packit Service |
20376f |
* | |
|
|
Packit Service |
20376f |
* | | * commit 1c30b88f5f3ee66d78df6520a7de9e89b890818b
|
|
Packit Service |
20376f |
* | | | Author: Scott J. Goldman <scottjg@github.com>
|
|
Packit Service |
20376f |
* | | | Date: Tue Nov 27 20:28:10 2012 -0800
|
|
Packit Service |
20376f |
* | | |
|
|
Packit Service |
20376f |
* | | | e
|
|
Packit Service |
20376f |
* | | |
|
|
Packit Service |
20376f |
* | | * commit 42b7311aa626e712891940c1ec5d5cba201946a4
|
|
Packit Service |
20376f |
* | | | Author: Scott J. Goldman <scottjg@github.com>
|
|
Packit Service |
20376f |
* | | | Date: Tue Nov 27 20:28:06 2012 -0800
|
|
Packit Service |
20376f |
* | | |
|
|
Packit Service |
20376f |
* | | | d
|
|
Packit Service |
20376f |
* | | |
|
|
Packit Service |
20376f |
* | | * commit a953a018c5b10b20c86e69fef55ebc8ad4c5a417
|
|
Packit Service |
20376f |
* | | |\ Merge: bd1732c cdf97fd
|
|
Packit Service |
20376f |
* | | |/ Author: Scott J. Goldman <scottjg@github.com>
|
|
Packit Service |
20376f |
* | |/| Date: Tue Nov 27 20:26:43 2012 -0800
|
|
Packit Service |
20376f |
* | | |
|
|
Packit Service |
20376f |
* | | | Merge branch 'first-branch'
|
|
Packit Service |
20376f |
* | | |
|
|
Packit Service |
20376f |
* | * | commit cdf97fd3bb48eb3827638bb33d208f5fd32d0aa6
|
|
Packit Service |
20376f |
* | | | Author: Scott J. Goldman <scottjg@github.com>
|
|
Packit Service |
20376f |
* | | | Date: Tue Nov 27 20:24:46 2012 -0800
|
|
Packit Service |
20376f |
* | | |
|
|
Packit Service |
20376f |
* | | | g
|
|
Packit Service |
20376f |
* | | |
|
|
Packit Service |
20376f |
* | * | commit ef0488f0b722f0be8bcb90a7730ac7efafd1d694
|
|
Packit Service |
20376f |
* | | | Author: Scott J. Goldman <scottjg@github.com>
|
|
Packit Service |
20376f |
* | | | Date: Tue Nov 27 20:24:39 2012 -0800
|
|
Packit Service |
20376f |
* | | |
|
|
Packit Service |
20376f |
* | | | f
|
|
Packit Service |
20376f |
* | | |
|
|
Packit Service |
20376f |
* | | * commit bd1732c43c68d712ad09e1d872b9be6d4b9efdc4
|
|
Packit Service |
20376f |
* | |/ Author: Scott J. Goldman <scottjg@github.com>
|
|
Packit Service |
20376f |
* | | Date: Tue Nov 27 17:43:58 2012 -0800
|
|
Packit Service |
20376f |
* | |
|
|
Packit Service |
20376f |
* | | c
|
|
Packit Service |
20376f |
* | |
|
|
Packit Service |
20376f |
* | * commit 0c8a3f1f3d5f421cf83048c7c73ee3b55a5e0f29
|
|
Packit Service |
20376f |
* |/ Author: Scott J. Goldman <scottjg@github.com>
|
|
Packit Service |
20376f |
* | Date: Tue Nov 27 17:43:48 2012 -0800
|
|
Packit Service |
20376f |
* |
|
|
Packit Service |
20376f |
* | b
|
|
Packit Service |
20376f |
* |
|
|
Packit Service |
20376f |
* * commit 1f4c0311a24b63f6fc209a59a1e404942d4a5006
|
|
Packit Service |
20376f |
* Author: Scott J. Goldman <scottjg@github.com>
|
|
Packit Service |
20376f |
* Date: Tue Nov 27 17:43:41 2012 -0800
|
|
Packit Service |
20376f |
*
|
|
Packit Service |
20376f |
* a
|
|
Packit Service |
20376f |
*/
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
void test_revwalk_mergebase__remove_redundant(void)
|
|
Packit Service |
20376f |
{
|
|
Packit Service |
20376f |
git_repository *repo;
|
|
Packit Service |
20376f |
git_oid one, two, base;
|
|
Packit Service |
20376f |
git_oidarray result = {NULL, 0};
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
cl_git_pass(git_repository_open(&repo, cl_fixture("redundant.git")));
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
cl_git_pass(git_oid_fromstr(&one, "d89137c93ba1ee749214ff4ce52ae9137bc833f9"));
|
|
Packit Service |
20376f |
cl_git_pass(git_oid_fromstr(&two, "91f4b95df4a59504a9813ba66912562931d990e3"));
|
|
Packit Service |
20376f |
cl_git_pass(git_oid_fromstr(&base, "6cb1f2352d974e1c5a776093017e8772416ac97a"));
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
cl_git_pass(git_merge_bases(&result, repo, &one, &two);;
|
|
Packit Service |
20376f |
cl_assert_equal_i(1, result.count);
|
|
Packit Service |
20376f |
cl_assert_equal_oid(&base, &result.ids[0]);
|
|
Packit Service |
20376f |
|
|
Packit Service |
20376f |
git_oidarray_free(&result);
|
|
Packit Service |
20376f |
git_repository_free(repo);
|
|
Packit Service |
20376f |
}
|