summaryrefslogtreecommitdiff
path: root/src/revwalk.c
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2010-07-07 14:56:05 +0200
committerVicent Marti <tanoku@gmail.com>2010-07-15 23:40:52 +0200
commit52f2390b4308fe51ecceecbc35a87bf6e74e9aa8 (patch)
tree15595ebcc29767ee05eb33adb216fc2e92af85f4 /src/revwalk.c
parent225fe21522a98075bdc18dae90ce459f797ac366 (diff)
downloadlibgit2-52f2390b4308fe51ecceecbc35a87bf6e74e9aa8.tar.gz
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 <tanoku@gmail.com>
Diffstat (limited to 'src/revwalk.c')
-rw-r--r--src/revwalk.c9
1 files changed, 5 insertions, 4 deletions
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;
}