All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Patrick Steinhardt <ps@pks.im>
Cc: Jeff King <peff@peff.net>,
	 git@vger.kernel.org,  Tian Yuchen <cat@malon.dev>
Subject: Re: [PATCH] read_gitfile_gently(): return non-repo path on error
Date: Wed, 10 Jun 2026 06:01:03 -0700	[thread overview]
Message-ID: <xmqqeciezh0w.fsf@gitster.g> (raw)
In-Reply-To: <ah6WEtk2pXyViEQA@pks.im> (Patrick Steinhardt's message of "Tue, 2 Jun 2026 10:36:34 +0200")

Patrick Steinhardt <ps@pks.im> writes:

> On Tue, Jun 02, 2026 at 02:11:59AM -0400, Jeff King wrote:
> [snip]
>> Two other points of interest.
>> 
>> One, I'm not sure how useful printing the pointed-to directory is. We
>> _could_ just say:
>> 
>>   fatal: gitfile does not point to a valid repository: /path/to/.git
>> 
>> which is enough for somebody to investigate themselves. That would
>> certainly make the patch smaller.
>
> I have to agree that the patch is somewhat gross, and I myself don't
> really see much of an issue to move to an error message like the above
> if it ends up simplifying the logic.

So we are in agreement among three of us that simplifying the code
to lose error message with dubious value would be a good way
forward.

Peff, can we have a formal [v2] then?

>> diff --git a/setup.c b/setup.c
>> index 075bf89fa9..2df6fbf595 100644
>> --- a/setup.c
>> +++ b/setup.c
>> @@ -1641,9 +1650,11 @@ static enum discovery_result setup_git_directory_gently_1(struct strbuf *dir,
>>  					return GIT_DIR_INVALID_GITFILE;
>>  			default:
>>  				if (die_on_error)
>> -					read_gitfile_error_die(error_code, dir->buf, NULL);
>> -				else
>> +					read_gitfile_error_die(error_code, dir->buf, error_dst);
>> +				else {
>> +					free(error_dst);
>>  					return GIT_DIR_INVALID_GITFILE;
>> +				}
>
> The `if` branch should also gain some curly braces here.

True.

Thanks.

  parent reply	other threads:[~2026-06-10 13:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-02  6:11 [PATCH] read_gitfile_gently(): return non-repo path on error Jeff King
2026-06-02  7:42 ` Junio C Hamano
2026-06-02  8:02   ` Jeff King
2026-06-02  8:36 ` Patrick Steinhardt
2026-06-04  6:27   ` Jeff King
2026-06-04  7:08     ` Patrick Steinhardt
2026-06-10 13:01   ` Junio C Hamano [this message]
2026-06-16 11:19     ` [PATCH v2] read_gitfile(): simplify NOT_A_REPO error message Jeff King
2026-06-16 12:35       ` [PATCH v3] " Jeff King
2026-06-16 14:25         ` Junio C Hamano
2026-06-16 14:45           ` Jeff King
2026-06-16 15:48             ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqeciezh0w.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=cat@malon.dev \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    --cc=ps@pks.im \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.