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
2b92a154
Commit
2b92a154
authored
Jul 11, 2012
by
nulltoken
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit: reduce code duplication
parent
8f17ed80
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
10 deletions
+9
-10
src/commit.c
+9
-10
No files found.
src/commit.c
View file @
2b92a154
...
...
@@ -229,19 +229,25 @@ GIT_COMMIT_GETTER(int, time_offset, commit->committer->when.offset)
GIT_COMMIT_GETTER
(
unsigned
int
,
parentcount
,
commit
->
parent_oids
.
length
)
GIT_COMMIT_GETTER
(
const
git_oid
*
,
tree_oid
,
&
commit
->
tree_oid
);
int
git_commit_tree
(
git_tree
**
tree_out
,
git_commit
*
commit
)
{
assert
(
commit
);
return
git_tree_lookup
(
tree_out
,
commit
->
object
.
repo
,
&
commit
->
tree_oid
);
}
const
git_oid
*
git_commit_parent_oid
(
git_commit
*
commit
,
unsigned
int
n
)
{
assert
(
commit
);
return
git_vector_get
(
&
commit
->
parent_oids
,
n
);
}
int
git_commit_parent
(
git_commit
**
parent
,
git_commit
*
commit
,
unsigned
int
n
)
{
git_oid
*
parent_oid
;
const
git_oid
*
parent_oid
;
assert
(
commit
);
parent_oid
=
git_
vector_get
(
&
commit
->
parent_oids
,
n
);
parent_oid
=
git_
commit_parent_oid
(
commit
,
n
);
if
(
parent_oid
==
NULL
)
{
giterr_set
(
GITERR_INVALID
,
"Parent %u does not exist"
,
n
);
return
GIT_ENOTFOUND
;
...
...
@@ -249,10 +255,3 @@ int git_commit_parent(git_commit **parent, git_commit *commit, unsigned int n)
return
git_commit_lookup
(
parent
,
commit
->
object
.
repo
,
parent_oid
);
}
const
git_oid
*
git_commit_parent_oid
(
git_commit
*
commit
,
unsigned
int
n
)
{
assert
(
commit
);
return
git_vector_get
(
&
commit
->
parent_oids
,
n
);
}
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