git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Phillip Wood <phillip.wood123@gmail.com>
To: Taylor Blau <me@ttaylorr.com>
Cc: Ronan Pigott <ronan@rjp.ie>,
	git@vger.kernel.org, me@ttaylor.com, derrickstolee@github.com
Subject: Re: [PATCH v2 2/2] maintenance: add option to register in a specific config
Date: Tue, 8 Nov 2022 21:28:25 +0000	[thread overview]
Message-ID: <7730f942-7332-4408-a2c0-f6ccde3cdb3a@dunelm.org.uk> (raw)
In-Reply-To: <Y2rCsq5y9TuCfrKC@nand.local>

Hi Taylor

On 08/11/2022 20:57, Taylor Blau wrote:
> On Tue, Nov 08, 2022 at 08:38:51PM +0000, Phillip Wood wrote:
>>> diff --git a/builtin/gc.c b/builtin/gc.c
>>> index 24ea85c7af..1709355bce 100644
>>> --- a/builtin/gc.c
>>> +++ b/builtin/gc.c
>>> @@ -1497,12 +1499,16 @@ static int maintenance_register(int argc, const char **argv, const char *prefix)
>>>    	if (!found) {
>>>    		int rc;
>>> -		char *user_config, *xdg_config;
>>> -		git_global_config(&user_config, &xdg_config);
>>> -		if (!user_config)
>>> -			die(_("$HOME not set"));
>>> +		char *user_config = NULL, *xdg_config = NULL;
>>> +
>>> +		if (!config_file) {
>>> +			git_global_config(&user_config, &xdg_config);
>>> +			config_file = user_config;
>>
>> Here we need to decide whether to use user_config or xdg_config as the
>> config file. In builtin/config.c we do this with
>>
>> 		if (access_or_warn(user_config, R_OK, 0) &&
>> 		    xdg_config && !access_or_warn(xdg_config, R_OK, 0)) {
>> 			given_config_source.file = xdg_config;
>> 			free(user_config);
>> 		} else {
>> 			given_config_source.file = user_config;
>> 			free(xdg_config);
>> 		}
>>
>> We need something similar here (maybe we should create a helper function to
>> find the appropriate file)
>>
>>> +			if (!user_config)
>>> +				die(_("$HOME not set"));
>>
>> This check needs to come before deciding which config file to use
> 
> True, but that problem existed before this series, too.

Oh yes, sorry I'd missed that

Phillip

> So the new
> behavior is no worse with respect to the XDG config stuff, and any
> improvements to that behavior can be done independently on top. >> Thanks,
> Taylor

  reply	other threads:[~2022-11-08 21:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-08 19:49 [PATCH v2 0/2] git-maintenance quality-of-life improvements Ronan Pigott
2022-11-08 19:49 ` [PATCH v2 1/2] for-each-repo: interpolate repo path arguments Ronan Pigott
2022-11-08 19:49 ` [PATCH v2 2/2] maintenance: add option to register in a specific config Ronan Pigott
2022-11-08 20:38   ` Phillip Wood
2022-11-08 20:57     ` Taylor Blau
2022-11-08 21:28       ` Phillip Wood [this message]
2022-11-08 22:45       ` ronan
2022-11-09 15:05   ` Derrick Stolee
2022-11-10  2:38     ` Taylor Blau
2022-11-08 19:54 ` [PATCH v2 0/2] git-maintenance quality-of-life improvements Taylor Blau

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=7730f942-7332-4408-a2c0-f6ccde3cdb3a@dunelm.org.uk \
    --to=phillip.wood123@gmail.com \
    --cc=derrickstolee@github.com \
    --cc=git@vger.kernel.org \
    --cc=me@ttaylor.com \
    --cc=me@ttaylorr.com \
    --cc=phillip.wood@dunelm.org.uk \
    --cc=ronan@rjp.ie \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).