git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	git@vger.kernel.org, Thomas Gummerer <t.gummerer@gmail.com>,
	Andrew Arnott <Andrew.Arnott@microsoft.com>
Subject: Re: [PATCH 2/2] Be more careful when determining whether a remote was configured
Date: Thu, 19 Jan 2017 12:12:47 -0800	[thread overview]
Message-ID: <xmqq4m0u24hs.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20170119182721.7y2zzrbaalfqjjn6@sigill.intra.peff.net> (Jeff King's message of "Thu, 19 Jan 2017 13:27:21 -0500")

Jeff King <peff@peff.net> writes:

> On Wed, Jan 18, 2017 at 05:22:40PM +0100, Johannes Schindelin wrote:
>
>> > > I want to err on the side of caution. That's why.
>> > 
>> > I guess I just don't see why changing the behavior with respect to
>> > "prune" or "proxy" is any less conservative than changing the one for
>> > "refspec".
>> 
> I think _this_ is a much better way of framing the problem. It is not
> about which keys are set, but about _where_ they are set. IOW, a
> reasonable rule would be: if there is any remote.*.X in the repo config,
> then git-remote should consider it a configured repo. And otherwise, no
> matter what is in ~/.gitconfig or elsewhere, git-remote should proceed
> as if it doesn't exist (and repo-level config can take precedence over
> config defined elsewhere).
>
> I.e., something like this:
>
> diff --git a/remote.c b/remote.c
> index 298f2f93f..720d616be 100644
> --- a/remote.c
> +++ b/remote.c
> @@ -373,6 +373,8 @@ static int handle_config(const char *key, const char *value, void *cb)
>  	}
>  	remote = make_remote(name, namelen);
>  	remote->origin = REMOTE_CONFIG;
> +	if (current_config_scope() == CONFIG_SCOPE_REPO)
> +		remote->configured = 1;
>  	if (!strcmp(subkey, "mirror"))
>  		remote->mirror = git_config_bool(key, value);
>  	else if (!strcmp(subkey, "skipdefaultupdate"))
>
> That doesn't make your test pass, but I think that is only because your
> test is not covering the interesting case (it puts the new config in the
> repo config, not in ~/.gitconfig).
>
> What do you think?
>
>> Originally, I would even have put the "vcs" into that set, as I could see
>> a legitimate use case for users to configure "remote.svn.vcs = vcs" in
>> ~/.gitconfig. But the regression test suite specifically tests for that
>> case, and I trust that there was a good reason, even if Thomas did not
>> describe that good reason in the commit message nor in any reply to this
>> patch pair.
>
> The config-scope thing above would allow "remote.svn.vcs" in
> ~/.gitconfig. But I don't think the test script actually checks that; it
> checks for the repo-level config. And we would continue to do the right
> thing there.

I am not "you" you are addressing to, but I think tying it to where
the variable came from makes quite sense.  

Because it makes it no longer possible to just inspect the
configured result to answer "is the remote configured?",
introduction of the configured field also needs to be preserved from
the original by Dscho, so does reading from historical non-config
sources like $GIT_DIR/remotes/*, which are by definition
per-repository thing.

IOW, with this tweak (and not setting ->configured based on what
keys are set), I think Dscho's patch makes sense.


  reply	other threads:[~2017-01-19 20:27 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-17 21:18 [PATCH 0/2] Fix remote_is_configured() Johannes Schindelin
2017-01-17 21:19 ` [PATCH 1/2] remote rename: demonstrate a bogus "remote exists" bug Johannes Schindelin
2017-01-17 21:19 ` [PATCH 2/2] Be more careful when determining whether a remote was configured Johannes Schindelin
2017-01-17 21:47   ` Jeff King
2017-01-17 22:19     ` Junio C Hamano
2017-01-18 12:38       ` Johannes Schindelin
2017-01-18 12:34     ` Johannes Schindelin
2017-01-18 12:54       ` Jeff King
2017-01-18 16:22         ` Johannes Schindelin
2017-01-19 18:27           ` Jeff King
2017-01-19 20:12             ` Junio C Hamano [this message]
2017-01-19 20:22               ` Jeff King
2017-01-19 21:19             ` Johannes Schindelin
2017-01-17 21:45 ` [PATCH 0/2] Fix remote_is_configured() Jeff King
2017-01-19 21:19 ` [PATCH v2 " Johannes Schindelin
2017-01-19 21:19   ` [PATCH v2 1/2] remote rename: demonstrate a bogus "remote exists" bug Johannes Schindelin
2017-01-19 21:20   ` [PATCH v2 2/2] Be more careful when determining whether a remote was configured Johannes Schindelin
2017-01-19 21:31     ` Jeff King
2017-01-19 21:44       ` Johannes Schindelin
2017-01-19 21:45       ` Junio C Hamano
2017-01-19 21:50         ` Jeff King

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=xmqq4m0u24hs.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=Andrew.Arnott@microsoft.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    --cc=t.gummerer@gmail.com \
    /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).