git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] stash: show error message when lockfile is present

From
BTBirk Tjelmeland <git@birktj.no>
Date
Nov 8, 2021, 20:35 UTC
Message-ID
<0777e271-d5cc-45b2-97b2-7597cf75ad86@www.fastmail.com>
In-Reply-To
<xmqqsfw6tnu7.fsf@gitster.g>
Show 6 quoted lines
> 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

Previous: Junio C Hamano
Message 8 of 8 in “stash: show error message when lockfile is present”
  1. stash: show error message when lockfile is presentBirk Tjelmeland, Nov 7, 2021
  2. Taylor BlauNov 8, 2021
  3. Taylor BlauNov 8, 2021
  4. Junio C HamanoNov 8, 2021
  5. Taylor BlauNov 8, 2021
  6. Ævar Arnfjörð BjarmasonNov 8, 2021
  7. Junio C HamanoNov 8, 2021
  8. Birk TjelmelandNov 8, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.