mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-30 22:24:56 +00:00
Merge pull request #958 from schu/fix-merge-base
revwalk: fix off-by-one error
This commit is contained in:
commit
3f849902e4
@ -274,7 +274,8 @@ static int commit_parse(git_revwalk *walk, commit_object *commit)
|
|||||||
static int interesting(git_pqueue *list)
|
static int interesting(git_pqueue *list)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
for (i = 1; i < git_pqueue_size(list); i++) {
|
/* element 0 isn't used - we need to start at 1 */
|
||||||
|
for (i = 1; i < list->size; i++) {
|
||||||
commit_object *commit = list->d[i];
|
commit_object *commit = list->d[i];
|
||||||
if ((commit->flags & STALE) == 0)
|
if ((commit->flags & STALE) == 0)
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -42,7 +42,7 @@ void test_odb_foreach__foreach(void)
|
|||||||
git_repository_odb(&_odb, _repo);
|
git_repository_odb(&_odb, _repo);
|
||||||
|
|
||||||
cl_git_pass(git_odb_foreach(_odb, foreach_cb, NULL));
|
cl_git_pass(git_odb_foreach(_odb, foreach_cb, NULL));
|
||||||
cl_assert_equal_i(43 + 1640, nobj); /* count + in-pack */
|
cl_assert_equal_i(46 + 1640, nobj); /* count + in-pack */
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_odb_foreach__one_pack(void)
|
void test_odb_foreach__one_pack(void)
|
||||||
|
Binary file not shown.
@ -0,0 +1,2 @@
|
|||||||
|
x<01>ŽM
|
||||||
|
Â0F]ç³d2<64>¤ñ®<A~&´`ÄôþV<C3BE>àæãmïËë²ÌÈÒ¡7Uà$äJöL9yM!¢GuœªH¤&UÈæ›>;ÔÂÁ…¬£³X†ÂEÈŽ5R±£ ÛAÑE&n}ZÜæ<E}À=O[ÒÖáüÞéú<C3A9>Ó¼^À,ã^†#¢É¿ƒ]ÿPÍ`>™A¹
|
Binary file not shown.
@ -67,6 +67,15 @@ void test_revwalk_mergebase__no_common_ancestor_returns_ENOTFOUND(void)
|
|||||||
cl_assert_equal_i(GIT_ENOTFOUND, error);
|
cl_assert_equal_i(GIT_ENOTFOUND, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void test_revwalk_mergebase__no_off_by_one_missing(void)
|
||||||
|
{
|
||||||
|
git_oid result, one, two;
|
||||||
|
|
||||||
|
cl_git_pass(git_oid_fromstr(&one, "1a443023183e3f2bfbef8ac923cd81c1018a18fd"));
|
||||||
|
cl_git_pass(git_oid_fromstr(&two, "9f13f7d0a9402c681f91dc590cf7b5470e6a77d2"));
|
||||||
|
cl_git_pass(git_merge_base(&result, _repo, &one, &two));
|
||||||
|
}
|
||||||
|
|
||||||
static void assert_mergebase_many(const char *expected_sha, int count, ...)
|
static void assert_mergebase_many(const char *expected_sha, int count, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
Loading…
Reference in New Issue
Block a user