"Elijah Newren via GitGitGadget" <gitgitgadget@xxxxxxxxx> writes: > @@ -386,11 +386,11 @@ static void restore_state(const struct object_id *head, > const char *args[] = { "stash", "apply", "--index", "--quiet", > NULL, NULL }; > > - if (is_null_oid(stash)) > - return; > - > reset_hard(head, 1); > > + if (is_null_oid(stash)) > + goto refresh_cache; > + OK, so the idea is that we can call restore_state() without having anything worth "restoring" in the stash, and what it means is that we are restoring to HEAD. As the current state does not necessarily match HEAD, we should do the "reset --hard" part even if there was nothing to stash. Makes sense.