From 12114415ab62f7b7958f33bc7229963061b269df Mon Sep 17 00:00:00 2001 From: Justin Love Date: Tue, 30 Nov 2010 21:01:47 -0600 Subject: add git_commit_parentcount --- src/commit.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/commit.c') 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); -- cgit v1.2.1