Commit d80e9d55 by Vicent Marti

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>
parent 57450775
...@@ -237,7 +237,8 @@ int git_commit__parse_full(git_commit *commit) ...@@ -237,7 +237,8 @@ int git_commit__parse_full(git_commit *commit)
assert(commit); \ assert(commit); \
if (commit->_name) \ if (commit->_name) \
return commit->_name; \ return commit->_name; \
git_commit__parse_full(commit); \ if (!commit->object.in_memory) \
git_commit__parse_full(commit); \
return commit->_name; \ return commit->_name; \
} }
...@@ -258,7 +259,9 @@ time_t git_commit_time(git_commit *commit) ...@@ -258,7 +259,9 @@ time_t git_commit_time(git_commit *commit)
if (commit->commit_time) if (commit->commit_time)
return 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; return commit->commit_time;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment