diff options
author | Justin Love <git@JustinLove.name> | 2010-11-30 21:01:47 -0600 |
---|---|---|
committer | Justin Love <git@JustinLove.name> | 2010-11-30 21:27:12 -0600 |
commit | 12114415ab62f7b7958f33bc7229963061b269df (patch) | |
tree | c584738210817399f792b3f678e6080a4b628408 /src/commit.c | |
parent | 8c1f9e4dc346d650e43252fe2a653d9dfeb85cf2 (diff) | |
download | libgit2-12114415ab62f7b7958f33bc7229963061b269df.tar.gz |
add git_commit_parentcount
Diffstat (limited to 'src/commit.c')
-rw-r--r-- | src/commit.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/commit.c b/src/commit.c index 6fcbfd734..b8d9f8784 100644 --- a/src/commit.c +++ b/src/commit.c @@ -257,6 +257,21 @@ time_t git_commit_time(git_commit *commit) return commit->commit_time; } +unsigned int git_commit_parentcount(git_commit *commit) +{ + git_commit_parents *parent; + unsigned int count = 0; + + assert(commit); + CHECK_FULL_PARSE(); + + for (parent = commit->parents; parent != NULL; parent = parent->next) { + count++; + } + + return count; +} + void git_commit_set_tree(git_commit *commit, git_tree *tree) { assert(commit && tree); |