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
5924b282
Commit
5924b282
authored
Apr 06, 2011
by
Sam
Committed by
Vicent Marti
Apr 08, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added git_commit_tree_oid and git_commit_parent_oid.
parent
98ac6780
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
0 deletions
+26
-0
include/git2/commit.h
+20
-0
src/commit.c
+6
-0
No files found.
include/git2/commit.h
View file @
5924b282
...
@@ -136,6 +136,16 @@ GIT_EXTERN(const git_signature *) git_commit_author(git_commit *commit);
...
@@ -136,6 +136,16 @@ GIT_EXTERN(const git_signature *) git_commit_author(git_commit *commit);
GIT_EXTERN
(
int
)
git_commit_tree
(
git_tree
**
tree_out
,
git_commit
*
commit
);
GIT_EXTERN
(
int
)
git_commit_tree
(
git_tree
**
tree_out
,
git_commit
*
commit
);
/**
/**
* Get the id of the tree pointed to by a commit. This differs from
* `git_commit_tree` in that no attempts are made to fetch an object
* from the ODB.
*
* @param commit a previously loaded commit.
* @return the id of tree pointed to by commit.
*/
GIT_EXTERN
(
const
git_oid
*
)
git_commit_tree_oid
(
git_commit
*
commit
);
/**
* Get the number of parents of this commit
* Get the number of parents of this commit
*
*
* @param commit a previously loaded commit.
* @param commit a previously loaded commit.
...
@@ -153,6 +163,16 @@ GIT_EXTERN(unsigned int) git_commit_parentcount(git_commit *commit);
...
@@ -153,6 +163,16 @@ GIT_EXTERN(unsigned int) git_commit_parentcount(git_commit *commit);
*/
*/
GIT_EXTERN
(
int
)
git_commit_parent
(
git_commit
**
parent
,
git_commit
*
commit
,
unsigned
int
n
);
GIT_EXTERN
(
int
)
git_commit_parent
(
git_commit
**
parent
,
git_commit
*
commit
,
unsigned
int
n
);
/**
* Get the oid of a specified parent for a commit. This is different from
* `git_commit_parent`, which will attempt to load the parent commit from
* the ODB.
*
* @param commit a previously loaded commit.
* @param n the position of the parent (from 0 to `parentcount`)
* @return the id of the parent, NULL on error.
*/
GIT_EXTERN
(
const
git_oid
*
)
git_commit_parent_oid
(
git_commit
*
commit
,
unsigned
int
n
);
/**
/**
* Create a new commit in the repository
* Create a new commit in the repository
...
...
src/commit.c
View file @
5924b282
...
@@ -318,6 +318,7 @@ GIT_COMMIT_GETTER(const char *, message_short, commit->message_short)
...
@@ -318,6 +318,7 @@ GIT_COMMIT_GETTER(const char *, message_short, commit->message_short)
GIT_COMMIT_GETTER
(
git_time_t
,
time
,
commit
->
committer
->
when
.
time
)
GIT_COMMIT_GETTER
(
git_time_t
,
time
,
commit
->
committer
->
when
.
time
)
GIT_COMMIT_GETTER
(
int
,
time_offset
,
commit
->
committer
->
when
.
offset
)
GIT_COMMIT_GETTER
(
int
,
time_offset
,
commit
->
committer
->
when
.
offset
)
GIT_COMMIT_GETTER
(
unsigned
int
,
parentcount
,
commit
->
parent_oids
.
length
)
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
)
int
git_commit_tree
(
git_tree
**
tree_out
,
git_commit
*
commit
)
...
@@ -338,4 +339,9 @@ int git_commit_parent(git_commit **parent, git_commit *commit, unsigned int n)
...
@@ -338,4 +339,9 @@ int git_commit_parent(git_commit **parent, git_commit *commit, unsigned int n)
return
git_commit_lookup
(
parent
,
commit
->
object
.
repo
,
parent_oid
);
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