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
36a80fda
Commit
36a80fda
authored
Mar 20, 2014
by
Vicent Marti
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2195 from libgit2/cmn/revwalk-no-hide
revwalk: don't try to find merge bases when there can be none
parents
7d633572
704b55cc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
5 deletions
+22
-5
src/merge.c
+6
-0
src/revwalk.c
+14
-4
src/revwalk.h
+2
-1
No files found.
src/merge.c
View file @
36a80fda
...
@@ -205,6 +205,12 @@ int git_merge__bases_many(git_commit_list **out, git_revwalk *walk, git_commit_l
...
@@ -205,6 +205,12 @@ int git_merge__bases_many(git_commit_list **out, git_revwalk *walk, git_commit_l
git_commit_list
*
result
=
NULL
,
*
tmp
=
NULL
;
git_commit_list
*
result
=
NULL
,
*
tmp
=
NULL
;
git_pqueue
list
;
git_pqueue
list
;
/* If there's only the one commit, there can be no merge bases */
if
(
twos
->
length
==
0
)
{
*
out
=
NULL
;
return
0
;
}
/* if the commit is repeated, we have a our merge base already */
/* if the commit is repeated, we have a our merge base already */
git_vector_foreach
(
twos
,
i
,
two
)
{
git_vector_foreach
(
twos
,
i
,
two
)
{
if
(
one
==
two
)
if
(
one
==
two
)
...
...
src/revwalk.c
View file @
36a80fda
...
@@ -141,6 +141,9 @@ static int push_commit(git_revwalk *walk, const git_oid *oid, int uninteresting,
...
@@ -141,6 +141,9 @@ static int push_commit(git_revwalk *walk, const git_oid *oid, int uninteresting,
if
(
commit
==
NULL
)
if
(
commit
==
NULL
)
return
-
1
;
/* error already reported by failed lookup */
return
-
1
;
/* error already reported by failed lookup */
if
(
uninteresting
)
walk
->
did_hide
=
1
;
commit
->
uninteresting
=
uninteresting
;
commit
->
uninteresting
=
uninteresting
;
if
(
walk
->
one
==
NULL
&&
!
uninteresting
)
{
if
(
walk
->
one
==
NULL
&&
!
uninteresting
)
{
walk
->
one
=
commit
;
walk
->
one
=
commit
;
...
@@ -390,11 +393,18 @@ static int prepare_walk(git_revwalk *walk)
...
@@ -390,11 +393,18 @@ static int prepare_walk(git_revwalk *walk)
return
GIT_ITEROVER
;
return
GIT_ITEROVER
;
}
}
/* first figure out what the merge bases are */
/*
if
(
git_merge__bases_many
(
&
bases
,
walk
,
walk
->
one
,
&
walk
->
twos
)
<
0
)
* If the user asked to hide commits, we need to figure out
return
-
1
;
* what the merge bases are so we can know when we can stop
* marking parents uninteresting.
*/
if
(
walk
->
did_hide
)
{
if
(
git_merge__bases_many
(
&
bases
,
walk
,
walk
->
one
,
&
walk
->
twos
)
<
0
)
return
-
1
;
git_commit_list_free
(
&
bases
);
}
git_commit_list_free
(
&
bases
);
if
(
process_commit
(
walk
,
walk
->
one
,
walk
->
one
->
uninteresting
)
<
0
)
if
(
process_commit
(
walk
,
walk
->
one
,
walk
->
one
->
uninteresting
)
<
0
)
return
-
1
;
return
-
1
;
...
...
src/revwalk.h
View file @
36a80fda
...
@@ -32,7 +32,8 @@ struct git_revwalk {
...
@@ -32,7 +32,8 @@ struct git_revwalk {
int
(
*
enqueue
)(
git_revwalk
*
,
git_commit_list_node
*
);
int
(
*
enqueue
)(
git_revwalk
*
,
git_commit_list_node
*
);
unsigned
walking
:
1
,
unsigned
walking
:
1
,
first_parent
:
1
;
first_parent
:
1
,
did_hide
:
1
;
unsigned
int
sorting
;
unsigned
int
sorting
;
/* merge base calculation */
/* merge base calculation */
...
...
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