mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-09 22:39:38 +00:00
Rev-parse: proper error checking.
This commit is contained in:
parent
7e79d389a4
commit
94952ded3a
@ -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);
|
giterr_set(GITERR_INVALID, "Invalid reflogspec %s", reflogspec);
|
||||||
return GIT_ERROR;
|
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(®ex, "checkout: moving from (.*) to .*", REG_EXTENDED);
|
regex_error = regcomp(®ex, "checkout: moving from (.*) to .*", REG_EXTENDED);
|
||||||
if (regex_error != 0) {
|
if (regex_error != 0) {
|
||||||
giterr_set_regex(®ex, regex_error);
|
giterr_set_regex(®ex, regex_error);
|
||||||
@ -196,6 +195,9 @@ static int walk_ref_history(git_object **out, git_repository *repo, const char *
|
|||||||
}
|
}
|
||||||
regfree(®ex);
|
regfree(®ex);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
git_reference_free(ref);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
git_buf datebuf = GIT_BUF_INIT;
|
git_buf datebuf = GIT_BUF_INIT;
|
||||||
git_buf_put(&datebuf, reflogspec+2, reflogspeclen-3);
|
git_buf_put(&datebuf, reflogspec+2, reflogspeclen-3);
|
||||||
|
Loading…
Reference in New Issue
Block a user