From: Birk Tjelmeland Date: Mon, 08 Nov 2021 20:35:01 GMT Subject: Re: [PATCH] stash: show error message when lockfile is present Message-ID: <0777e271-d5cc-45b2-97b2-7597cf75ad86@www.fastmail.com> In-Reply-To: > I would think the "fix" should look more like this: > > read_cache_preload(NULL); > if (refresh_and_write_cache(REFRESH_QUIET, 0, 0)) > - return -1; > + return error(_("failed to refresh the index")); This is how the other callsites of refresh_and_write_cache (the ones outside of stash.c) solve this problem, however I agree with Ævar that this error is not as useful as the one given by LOCK_REPORT_ON_ERROR (which is why I wrote the patch this way to begin with, although I do see that it is not exactly the most elegant solution to the problem) > If the change were to (1) extend the flag word to make it more uniform, > so that it does not special case ONLY the lock-related errors Would adding a REFRESH_REPORT_ERRORS flag which could then be used with repo_refresh_and_write_index be a more acceptable solution? Then various functions in read-cache.c could check for this flag and output errors but not progress when it is present. Regards, Birk