mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-09 13:04:42 +00:00
stash: ensure a reflog has entries
This commit is contained in:
parent
d0dd3fcee7
commit
90f8408dac
@ -564,7 +564,7 @@ static int retrieve_stash_commit(
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
max = git_reflog_entrycount(reflog);
|
max = git_reflog_entrycount(reflog);
|
||||||
if (index > max - 1) {
|
if (!max || index > max - 1) {
|
||||||
error = GIT_ENOTFOUND;
|
error = GIT_ENOTFOUND;
|
||||||
giterr_set(GITERR_STASH, "No stashed state at position %" PRIuZ, index);
|
giterr_set(GITERR_STASH, "No stashed state at position %" PRIuZ, index);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -949,7 +949,7 @@ int git_stash_drop(
|
|||||||
|
|
||||||
max = git_reflog_entrycount(reflog);
|
max = git_reflog_entrycount(reflog);
|
||||||
|
|
||||||
if (index > max - 1) {
|
if (!max || index > max - 1) {
|
||||||
error = GIT_ENOTFOUND;
|
error = GIT_ENOTFOUND;
|
||||||
giterr_set(GITERR_STASH, "No stashed state at position %" PRIuZ, index);
|
giterr_set(GITERR_STASH, "No stashed state at position %" PRIuZ, index);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
Loading…
Reference in New Issue
Block a user