summaryrefslogtreecommitdiff
path: root/src/commit.c
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2010-10-31 06:01:46 +0200
committerVicent Marti <tanoku@gmail.com>2010-10-31 06:05:53 +0200
commitd80e9d55aa2d0629f7f207db42762494075d7854 (patch)
tree2ffc49662e6ed5e0fb26d2676fdfffc27c77c78d /src/commit.c
parent57450775571ca9c0be2eba164992abfc004d3226 (diff)
downloadlibgit2-d80e9d55aa2d0629f7f207db42762494075d7854.tar.gz
Fix in-memory commit getters trying to parse
Issue 9 on the tracker. The commit object getters for in-memory objects were trying to parse an inexistant on-disk object when one of the commit attributes which were still not set was queried. We now return a NULL value when this happens. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Diffstat (limited to 'src/commit.c')
-rw-r--r--src/commit.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/commit.c b/src/commit.c
index 4270bcd91..d0eb59f51 100644
--- a/src/commit.c
+++ b/src/commit.c
@@ -237,7 +237,8 @@ int git_commit__parse_full(git_commit *commit)
assert(commit); \
if (commit->_name) \
return commit->_name; \
- git_commit__parse_full(commit); \
+ if (!commit->object.in_memory) \
+ git_commit__parse_full(commit); \
return commit->_name; \
}
@@ -258,7 +259,9 @@ time_t git_commit_time(git_commit *commit)
if (commit->commit_time)
return commit->commit_time;
- git_commit__parse_full(commit);
+ if (!commit->object.in_memory)
+ git_commit__parse_full(commit);
+
return commit->commit_time;
}