Add external API to access detailed commit attributes
commit52f2390b4308fe51ecceecbc35a87bf6e74e9aa8
authorVicent Marti <tanoku@gmail.com>
Wed, 7 Jul 2010 12:56:05 +0000 (7 14:56 +0200)
committerVicent Marti <tanoku@gmail.com>
Thu, 15 Jul 2010 21:40:52 +0000 (15 23:40 +0200)
tree15595ebcc29767ee05eb33adb216fc2e92af85f4
parent225fe21522a98075bdc18dae90ce459f797ac366
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>
src/commit.c
src/commit.h
src/git/commit.h
src/revwalk.c
tests/t0401-parse.c
tests/t0402-details.c [new file with mode: 0644]