Subject: Re: [PATCH v3 7/7] merge: do not exit restore_state() prematurely

From: Junio C Hamano <[email-masked]>
Date: Thu, 21 Jul 2022 09:34:20 -0700

"Elijah Newren via GitGitGadget" <[email-masked]> 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.