From 52f2390b4308fe51ecceecbc35a87bf6e74e9aa8 Mon Sep 17 00:00:00 2001 From: Vicent Marti Date: Wed, 7 Jul 2010 14:56:05 +0200 Subject: Add external API to access detailed commit attributes The following new external methods have been added: GIT_EXTERN(const char *) git_commit_message_short(git_commit *commit); GIT_EXTERN(const char *) git_commit_message(git_commit *commit); GIT_EXTERN(time_t) git_commit_time(git_commit *commit); GIT_EXTERN(const git_commit_person *) git_commit_committer(git_commit *commit); GIT_EXTERN(const git_commit_person *) git_commit_author(git_commit *commit); GIT_EXTERN(const git_tree *) git_commit_tree(git_commit *commit); A new structure, git_commit_person has been added to represent a commit's author or committer. The parsing of a commit has been split in two phases. When adding a commit to the revision pool: - the commit's ODB object is opened - its raw contents are parsed for commit TIME, PARENTS and TREE (the minimal amount of data required to traverse the pool) - the commit's ODB object is closed When querying for extended information on a commit: - the commit's ODB object is reopened - its raw contents are parsed for the requested information - the commit's ODB object remains open to handle additional queries New unit tests have been added for the new functionality: In t0401-parse: parse_person_test In t0402-details: query_details_test Signed-off-by: Vicent Marti --- src/revwalk.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/revwalk.c') diff --git a/src/revwalk.c b/src/revwalk.c index 422ef9df8..d4627ae2e 100644 --- a/src/revwalk.c +++ b/src/revwalk.c @@ -92,8 +92,9 @@ int gitrp_push(git_revpool *pool, git_commit *commit) if (commit->object.pool != pool || pool->walking) return GIT_ERROR; - if (!commit->parsed) { - int error = git_commit_parse_existing(commit); + if (!commit->basic_parse) { + int error = git_commit__parse_basic(commit); + if (error < 0) return error; } @@ -129,8 +130,8 @@ int gitrp__enroot(git_revpool *pool, git_commit *commit) if (commit->seen) return 0; - if (commit->parsed == 0) { - error = git_commit_parse_existing(commit); + if (!commit->basic_parse) { + error = git_commit__parse_basic(commit); if (error < 0) return error; } -- cgit v1.2.1