Commit 94952ded by Ben Straub

Rev-parse: proper error checking.

parent 7e79d389
......@@ -169,10 +169,9 @@ static int walk_ref_history(git_object **out, git_repository *repo, const char *
giterr_set(GITERR_INVALID, "Invalid reflogspec %s", reflogspec);
return GIT_ERROR;
}
git_reference_lookup(&ref, repo, "HEAD");
git_reflog_read(&reflog, ref);
git_reference_free(ref);
if (!git_reference_lookup(&ref, repo, "HEAD")) {
if (!git_reflog_read(&reflog, ref)) {
regex_error = regcomp(&regex, "checkout: moving from (.*) to .*", REG_EXTENDED);
if (regex_error != 0) {
giterr_set_regex(&regex, regex_error);
......@@ -196,6 +195,9 @@ static int walk_ref_history(git_object **out, git_repository *repo, const char *
}
regfree(&regex);
}
}
git_reference_free(ref);
}
} else {
git_buf datebuf = GIT_BUF_INIT;
git_buf_put(&datebuf, reflogspec+2, reflogspeclen-3);
......
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