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

Re: [PATCH] setup: only die on invalid .git under RUN_SETUP

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 23, 2021, 15:21 UTC
Message-ID
<xmqq8s1xqcnq.fsf@gitster.g>
In-Reply-To
<87tukls7ax.fsf@evledraar.gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
Show 16 quoted lines
>>> +	int die_on_error = !nongit_ok;
>>> +	enum discovery_result discovery;
>>> ...    	/*
>>> +	case GIT_DIR_GITFILE_NOT_A_REPO:
>>> +		if (!nongit_ok)
>>> +			die(_("not a git repository: %s"), dir.buf);
>>> +		*nongit_ok = 1;
>>> +		break;
>>> +	case GIT_DIR_INVALID_GITFILE:
>>> +		if (!nongit_ok)
>>
>> Variable die_on_error could be used in two `if`s above.
>
> Re-reading my own code I think it's better just to drop die_on_error
> entirely and use !nongit_ok consistently, as the rest of the function
> does. What do yo think?

I think "not X_ok" means we do not consider X is OK, and agree with you that the code is clearer without an extra indirection (I do not know if you meant to address me, though).

Previous: Ævar Arnfjörð BjarmasonNext: Atharva Raykar
Message 11 of 17 in “Bug: All git operations fail when .git contains a non-existent gitdir”
  1. Tom CookJul 21, 2021
  2. brian m. carlsonJul 21, 2021
  3. Tom CookJul 22, 2021
  4. setup: only die on invalid .git under RUN_SETUPÆvar Arnfjörð Bjarmason, Jul 22, 2021
  5. Junio C HamanoJul 22, 2021
  6. Ævar Arnfjörð BjarmasonJul 22, 2021
  7. Junio C HamanoJul 23, 2021
  8. Tom CookJul 23, 2021
  9. Andrei RybakJul 22, 2021
  10. Ævar Arnfjörð BjarmasonJul 23, 2021
  11. Junio C HamanoJul 23, 2021
  12. Atharva RaykarJul 23, 2021
  13. Tom CookJul 23, 2021
  14. Ævar Arnfjörð BjarmasonJul 23, 2021
  15. Atharva RaykarJul 23, 2021
  16. David AguilarAug 30, 2021
  17. Tom CookAug 31, 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.