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
08c79128
Unverified
Commit
08c79128
authored
Jul 27, 2021
by
Edward Thomson
Committed by
GitHub
Jul 27, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5766 from lhchavez/cgraph-generation-cmp
commit-graph: Introduce `git_commit_list_generation_cmp`
parents
2370e491
6f544140
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
2 deletions
+21
-2
src/commit_list.c
+18
-0
src/commit_list.h
+1
-0
src/graph.c
+1
-1
src/merge.c
+1
-1
No files found.
src/commit_list.c
View file @
08c79128
...
@@ -12,6 +12,24 @@
...
@@ -12,6 +12,24 @@
#include "odb.h"
#include "odb.h"
#include "commit.h"
#include "commit.h"
int
git_commit_list_generation_cmp
(
const
void
*
a
,
const
void
*
b
)
{
uint32_t
generation_a
=
((
git_commit_list_node
*
)
a
)
->
generation
;
uint32_t
generation_b
=
((
git_commit_list_node
*
)
b
)
->
generation
;
if
(
!
generation_a
||
!
generation_b
)
{
/* Fall back to comparing by timestamps if at least one commit lacks a generation. */
return
git_commit_list_time_cmp
(
a
,
b
);
}
if
(
generation_a
<
generation_b
)
return
1
;
if
(
generation_a
>
generation_b
)
return
-
1
;
return
0
;
}
int
git_commit_list_time_cmp
(
const
void
*
a
,
const
void
*
b
)
int
git_commit_list_time_cmp
(
const
void
*
a
,
const
void
*
b
)
{
{
int64_t
time_a
=
((
git_commit_list_node
*
)
a
)
->
time
;
int64_t
time_a
=
((
git_commit_list_node
*
)
a
)
->
time
;
...
...
src/commit_list.h
View file @
08c79128
...
@@ -46,6 +46,7 @@ typedef struct git_commit_list {
...
@@ -46,6 +46,7 @@ typedef struct git_commit_list {
}
git_commit_list
;
}
git_commit_list
;
git_commit_list_node
*
git_commit_list_alloc_node
(
git_revwalk
*
walk
);
git_commit_list_node
*
git_commit_list_alloc_node
(
git_revwalk
*
walk
);
int
git_commit_list_generation_cmp
(
const
void
*
a
,
const
void
*
b
);
int
git_commit_list_time_cmp
(
const
void
*
a
,
const
void
*
b
);
int
git_commit_list_time_cmp
(
const
void
*
a
,
const
void
*
b
);
void
git_commit_list_free
(
git_commit_list
**
list_p
);
void
git_commit_list_free
(
git_commit_list
**
list_p
);
git_commit_list
*
git_commit_list_insert
(
git_commit_list_node
*
item
,
git_commit_list
**
list_p
);
git_commit_list
*
git_commit_list_insert
(
git_commit_list_node
*
item
,
git_commit_list
**
list_p
);
...
...
src/graph.c
View file @
08c79128
...
@@ -43,7 +43,7 @@ static int mark_parents(git_revwalk *walk, git_commit_list_node *one,
...
@@ -43,7 +43,7 @@ static int mark_parents(git_revwalk *walk, git_commit_list_node *one,
return
0
;
return
0
;
}
}
if
(
git_pqueue_init
(
&
list
,
0
,
2
,
git_commit_list_
time
_cmp
)
<
0
)
if
(
git_pqueue_init
(
&
list
,
0
,
2
,
git_commit_list_
generation
_cmp
)
<
0
)
return
-
1
;
return
-
1
;
if
(
git_commit_list_parse
(
walk
,
one
)
<
0
)
if
(
git_commit_list_parse
(
walk
,
one
)
<
0
)
...
...
src/merge.c
View file @
08c79128
...
@@ -387,7 +387,7 @@ static int paint_down_to_common(
...
@@ -387,7 +387,7 @@ static int paint_down_to_common(
int
error
;
int
error
;
unsigned
int
i
;
unsigned
int
i
;
if
(
git_pqueue_init
(
&
list
,
0
,
twos
->
length
*
2
,
git_commit_list_
time
_cmp
)
<
0
)
if
(
git_pqueue_init
(
&
list
,
0
,
twos
->
length
*
2
,
git_commit_list_
generation
_cmp
)
<
0
)
return
-
1
;
return
-
1
;
one
->
flags
|=
PARENT1
;
one
->
flags
|=
PARENT1
;
...
...
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