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
967da2c7
Unverified
Commit
967da2c7
authored
Jun 27, 2018
by
Edward Thomson
Committed by
GitHub
Jun 27, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4688 from mystor/sorted_revwalk_reset
Fix interaction between limited flag and sorting over resets
parents
0d1d9e1e
4fd81c53
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
2 deletions
+28
-2
src/revwalk.c
+3
-2
tests/revwalk/basic.c
+25
-0
No files found.
src/revwalk.c
View file @
967da2c7
...
...
@@ -455,7 +455,7 @@ static int get_revision(git_commit_list_node **out, git_revwalk *walk, git_commi
*/
if
(
!
walk
->
limited
)
{
if
((
error
=
add_parents_to_list
(
walk
,
commit
,
list
))
<
0
)
return
error
;
return
error
;
}
*
out
=
commit
;
...
...
@@ -678,7 +678,7 @@ void git_revwalk_sorting(git_revwalk *walk, unsigned int sort_mode)
walk
->
enqueue
=
&
revwalk_enqueue_unsorted
;
}
if
(
sort_mode
!=
GIT_SORT_NONE
)
if
(
walk
->
sorting
!=
GIT_SORT_NONE
)
walk
->
limited
=
1
;
}
...
...
@@ -737,6 +737,7 @@ void git_revwalk_reset(git_revwalk *walk)
walk
->
walking
=
0
;
walk
->
limited
=
0
;
walk
->
did_push
=
walk
->
did_hide
=
0
;
walk
->
sorting
=
GIT_SORT_NONE
;
}
int
git_revwalk_add_hide_cb
(
...
...
tests/revwalk/basic.c
View file @
967da2c7
...
...
@@ -197,6 +197,31 @@ void test_revwalk_basic__push_head(void)
cl_assert_equal_i
(
i
,
7
);
}
void
test_revwalk_basic__sorted_after_reset
(
void
)
{
int
i
=
0
;
git_oid
oid
;
revwalk_basic_setup_walk
(
NULL
);
git_oid_fromstr
(
&
oid
,
commit_head
);
/* push, sort, and test the walk */
cl_git_pass
(
git_revwalk_push
(
_walk
,
&
oid
));
git_revwalk_sorting
(
_walk
,
GIT_SORT_TIME
);
cl_git_pass
(
test_walk_only
(
_walk
,
commit_sorting_time
,
2
));
/* reset, push, and test again - we should see all entries */
git_revwalk_reset
(
_walk
);
cl_git_pass
(
git_revwalk_push
(
_walk
,
&
oid
));
while
(
git_revwalk_next
(
&
oid
,
_walk
)
==
0
)
i
++
;
cl_assert_equal_i
(
i
,
commit_count
);
}
void
test_revwalk_basic__push_head_hide_ref
(
void
)
{
int
i
=
0
;
...
...
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