Subject: Re: [PATCH v12 18/26] stash: convert push to builtin

From: SZEDER Gábor <[email-masked]>
Date: Tue, 19 Feb 2019 01:23:36 +0100

On Tue, Feb 12, 2019 at 11:18:37PM +0000, Thomas Gummerer wrote:
> Thanks.  I still didn't manage to reproduce it locally, but I was now
> able to test it on Travis CI.
> 
> The diff below fixes the issue, but I still need to spend some time to
> better understand why it does.

There is nothing like a fix that works, but you have no idea why :)

FWIW, I'm at a couple of thousands of '--stress' repetitions with your
patch below, and not a single failure yet.

> I'll hopefully be in a position to
> send a patch with a proper log message why this is the right fix in
> the next couple of days.
> 
> diff --git a/builtin/stash--helper.c b/builtin/stash--helper.c
> index c77f62c895..3dab488bd6 100644
> --- a/builtin/stash--helper.c
> +++ b/builtin/stash--helper.c
> @@ -231,6 +231,7 @@ static int reset_tree(struct object_id *i_tree, int update, int reset)
>  	struct tree *tree;
>  	struct lock_file lock_file = LOCK_INIT;
>  
> +	discard_cache();
>  	read_cache_preload(NULL);
>  	if (refresh_cache(REFRESH_QUIET))
>  		return -1;
> 
>