Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
8060cdc9
Commit
8060cdc9
authored
Sep 27, 2012
by
Michael Schubert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
revwalk: fix off-by-one error
Fixes #921.
parent
5942bd18
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
15 additions
and
2 deletions
+15
-2
src/revwalk.c
+2
-1
tests-clar/odb/foreach.c
+1
-1
tests-clar/resources/testrepo.git/objects/1a/443023183e3f2bfbef8ac923cd81c1018a18fd
+0
-0
tests-clar/resources/testrepo.git/objects/9f/13f7d0a9402c681f91dc590cf7b5470e6a77d2
+3
-0
tests-clar/resources/testrepo.git/objects/fd/4959ce7510db09d4d8217fa2d1780413e05a09
+0
-0
tests-clar/revwalk/mergebase.c
+9
-0
No files found.
src/revwalk.c
View file @
8060cdc9
...
@@ -274,7 +274,8 @@ static int commit_parse(git_revwalk *walk, commit_object *commit)
...
@@ -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
;
...
...
tests-clar/odb/foreach.c
View file @
8060cdc9
...
@@ -42,7 +42,7 @@ void test_odb_foreach__foreach(void)
...
@@ -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
(
4
3
+
1640
,
nobj
);
/* count + in-pack */
cl_assert_equal_i
(
4
6
+
1640
,
nobj
);
/* count + in-pack */
}
}
void
test_odb_foreach__one_pack
(
void
)
void
test_odb_foreach__one_pack
(
void
)
...
...
tests-clar/resources/testrepo.git/objects/1a/443023183e3f2bfbef8ac923cd81c1018a18fd
0 → 100644
View file @
8060cdc9
File added
tests-clar/resources/testrepo.git/objects/9f/13f7d0a9402c681f91dc590cf7b5470e6a77d2
0 → 100644
View file @
8060cdc9
File added
tests-clar/resources/testrepo.git/objects/fd/4959ce7510db09d4d8217fa2d1780413e05a09
0 → 100644
View file @
8060cdc9
File added
tests-clar/revwalk/mergebase.c
View file @
8060cdc9
...
@@ -67,6 +67,15 @@ void test_revwalk_mergebase__no_common_ancestor_returns_ENOTFOUND(void)
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment