* [PATCH] doc git: multivar configuration parameters append to existing values
@ 2014-06-16 12:49 Philip Oakley
2014-06-16 18:35 ` Tanay Abhra
2014-06-16 18:43 ` Junio C Hamano
0 siblings, 2 replies; 8+ messages in thread
From: Philip Oakley @ 2014-06-16 12:49 UTC (permalink / raw)
To: GitList, Junio C Hamano
Cc: Jeff King, Ævar Arnfjörð Bjarmason,
Robert Clausecker, Alex Riesen, Tanay Abhra
When the '-c' option is used to pass alternate URLs or similar
multivar parameters to git commands the effect is not what the user
expected [1,2].
Clarify that multivar configuration parameters do not supercede
previous values. Suggest an alternative style parameter.
[1] http://article.gmane.org/gmane.comp.version-control.git/250427
[2] http://article.gmane.org/gmane.comp.version-control.git/251529
Signed-off-by: Philip Oakley <philipoakley@iee.org>
---
Documentation/git.txt | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/Documentation/git.txt b/Documentation/git.txt
index 3bd68b0..bedbd76 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -440,7 +440,10 @@ example the following invocations are equivalent:
-c <name>=<value>::
Pass a configuration parameter to the command. The value
- given will override values from configuration files.
+ given will override single valued variables from configuration
+ files, and append to multivar variables. Previous multivar values
+ remain in effect. Use "insteadOf" style config variables when an
+ over-ride is needed.
The <name> is expected in the same format as listed by
'git config' (subkeys separated by dots).
--
1.9.4.msysgit.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] doc git: multivar configuration parameters append to existing values
2014-06-16 12:49 [PATCH] doc git: multivar configuration parameters append to existing values Philip Oakley
@ 2014-06-16 18:35 ` Tanay Abhra
2014-06-16 19:42 ` Philip Oakley
2014-06-16 18:43 ` Junio C Hamano
1 sibling, 1 reply; 8+ messages in thread
From: Tanay Abhra @ 2014-06-16 18:35 UTC (permalink / raw)
To: Philip Oakley
Cc: GitList, Junio C Hamano, Jeff King,
Ævar Arnfjörð Bjarmason, Robert Clausecker,
Alex Riesen, Matthieu Moy
On 06/16/2014 05:49 AM, Philip Oakley wrote:
> Pass a configuration parameter to the command. The value
> - given will override values from configuration files.
> + given will override single valued variables from configuration
> + files, and append to multivar variables. Previous multivar values
Nit: Forgive me if I am wrong, but `, and` is used for joining two independent
clauses. It would be better to drop the comma.
> + remain in effect. Use "insteadOf" style config variables when an
> + over-ride is needed.
> The <name> is expected in the same format as listed by
> 'git config' (subkeys separated by dots).
>
>
'insteadOf' is a very specific approach for a general suggestion because it is only
used in url.*.insteadof in the whole codebase. Also, it has a variation described in
urls.txt as "pushinsteadof". So, if a problem such as mentioned above arises in
a different scenario 'insteadOf' cannot be used in it.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] doc git: multivar configuration parameters append to existing values
2014-06-16 12:49 [PATCH] doc git: multivar configuration parameters append to existing values Philip Oakley
2014-06-16 18:35 ` Tanay Abhra
@ 2014-06-16 18:43 ` Junio C Hamano
2014-06-16 19:38 ` Philip Oakley
2014-06-16 19:48 ` Jeff King
1 sibling, 2 replies; 8+ messages in thread
From: Junio C Hamano @ 2014-06-16 18:43 UTC (permalink / raw)
To: Philip Oakley
Cc: GitList, Jeff King, Ævar Arnfjörð Bjarmason,
Robert Clausecker, Alex Riesen, Tanay Abhra
Philip Oakley <philipoakley@iee.org> writes:
> When the '-c' option is used to pass alternate URLs or similar
> multivar parameters to git commands the effect is not what the user
> expected [1,2].
>
> Clarify that multivar configuration parameters do not supercede
> previous values. Suggest an alternative style parameter.
>
> [1] http://article.gmane.org/gmane.comp.version-control.git/250427
> [2] http://article.gmane.org/gmane.comp.version-control.git/251529
>
> Signed-off-by: Philip Oakley <philipoakley@iee.org>
> ---
> Documentation/git.txt | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/git.txt b/Documentation/git.txt
> index 3bd68b0..bedbd76 100644
> --- a/Documentation/git.txt
> +++ b/Documentation/git.txt
> @@ -440,7 +440,10 @@ example the following invocations are equivalent:
>
> -c <name>=<value>::
> Pass a configuration parameter to the command. The value
> - given will override values from configuration files.
> + given will override single valued variables from configuration
> + files, and append to multivar variables. Previous multivar values
> + remain in effect. Use "insteadOf" style config variables when an
> + over-ride is needed.
> The <name> is expected in the same format as listed by
> 'git config' (subkeys separated by dots).
I have two doubts, while appreciating the overall direction to
clarify things very much.
* "single overrides, multiple appends" is not a wrong explanation
per-se, but sounds like an arbitrary rule that forces people to
memorize. I wonder if it makes it less burdensome for readers if
we just said "Git acts as if the given configuration is specified
at the very end of the configuration files"---once the reader
understands that Git reads all configuration varilables of the
same name and the code paths that *use* one of them pick the one
defined the last, it is easy to realize that "single overrides"
is merely a natural consequence of the appending nature of "-c".
* The last sentence added, i.e. "insteadof"-style, will not be
understood by any reader other than those who tried to use "-c"
on remote.*.url variables and does not belong here. A better
way/place to give that information is needed.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] doc git: multivar configuration parameters append to existing values
2014-06-16 18:43 ` Junio C Hamano
@ 2014-06-16 19:38 ` Philip Oakley
2014-06-16 21:10 ` Junio C Hamano
2014-06-16 19:48 ` Jeff King
1 sibling, 1 reply; 8+ messages in thread
From: Philip Oakley @ 2014-06-16 19:38 UTC (permalink / raw)
To: Junio C Hamano
Cc: GitList, Jeff King, Ævar Arnfjörð Bjarmason,
Robert Clausecker, Alex Riesen, Tanay Abhra
From: "Junio C Hamano" <gitster@pobox.com>
> Philip Oakley <philipoakley@iee.org> writes:
>
>> When the '-c' option is used to pass alternate URLs or similar
>> multivar parameters to git commands the effect is not what the user
>> expected [1,2].
>>
>> Clarify that multivar configuration parameters do not supercede
>> previous values. Suggest an alternative style parameter.
>>
>> [1] http://article.gmane.org/gmane.comp.version-control.git/250427
>> [2] http://article.gmane.org/gmane.comp.version-control.git/251529
>>
>> Signed-off-by: Philip Oakley <philipoakley@iee.org>
>> ---
>> Documentation/git.txt | 5 ++++-
>> 1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/Documentation/git.txt b/Documentation/git.txt
>> index 3bd68b0..bedbd76 100644
>> --- a/Documentation/git.txt
>> +++ b/Documentation/git.txt
>> @@ -440,7 +440,10 @@ example the following invocations are
>> equivalent:
>>
>> -c <name>=<value>::
>> Pass a configuration parameter to the command. The value
>> - given will override values from configuration files.
>> + given will override single valued variables from configuration
>> + files, and append to multivar variables. Previous multivar values
>> + remain in effect. Use "insteadOf" style config variables when an
>> + over-ride is needed.
>> The <name> is expected in the same format as listed by
>> 'git config' (subkeys separated by dots).
>
> I have two doubts, while appreciating the overall direction to
> clarify things very much.
>
> * "single overrides, multiple appends" is not a wrong explanation
> per-se, but sounds like an arbitrary rule that forces people to
> memorize.
At the time it felt like the most compact method of informing the
reader.
> I wonder if it makes it less burdensome for readers
> if
> we just said "Git acts as if the given configuration is specified
> at the very end of the configuration files"
I'd started with something like that..
> ---once
> the reader
> understands that Git reads all configuration varilables of the
> same name and the code paths that *use* one of them pick the one
> defined the last,
It's this step that's a concern. We shouldn't be forcing the reader to
implicitly grok that, especially as we don't actually say it elsewhere
(in the regular documentation).
> it is easy to realize that "single
> overrides"
> is merely a natural consequence of the appending nature of "-c".
Perhaps I should just say that [say it that way].
>
> * The last sentence added, i.e. "insteadof"-style, will not be
> understood by any reader other than those who tried to use "-c"
> on remote.*.url variables and does not belong here. A better
> way/place to give that information is needed.
I just wanted to indicate that some multivars do have get-out [override]
config parameters, though we aren't consistent about their names yet,
while giving a clue as to a typical name style.
It would also be good to get feedback from Robert and Ævar on whether
the text would actually be informative to them, as they took the time to
report the original 'conceptual breakage'.
Philip
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] doc git: multivar configuration parameters append to existing values
2014-06-16 18:35 ` Tanay Abhra
@ 2014-06-16 19:42 ` Philip Oakley
0 siblings, 0 replies; 8+ messages in thread
From: Philip Oakley @ 2014-06-16 19:42 UTC (permalink / raw)
To: Tanay Abhra
Cc: GitList, Junio C Hamano, Jeff King,
Ævar Arnfjörð Bjarmason, Robert Clausecker,
Alex Riesen, Matthieu Moy
From: "Tanay Abhra" <tanayabh@gmail.com>
> On 06/16/2014 05:49 AM, Philip Oakley wrote:
>
>> Pass a configuration parameter to the command. The value
>> - given will override values from configuration files.
>> + given will override single valued variables from configuration
>> + files, and append to multivar variables. Previous multivar values
>
> Nit: Forgive me if I am wrong, but `, and` is used for joining two
> independent
> clauses. It would be better to drop the comma.
I just wrote it in my local style ;-) I was sort of treating them as
independent, but see Junio's comments in a similar vein.
>
>> + remain in effect. Use "insteadOf" style config variables when an
>> + over-ride is needed.
>> The <name> is expected in the same format as listed by
>> 'git config' (subkeys separated by dots).
>>
>>
>
> 'insteadOf' is a very specific approach for a general suggestion
> because it is only
> used in url.*.insteadof in the whole codebase. Also, it has a
> variation described in
> urls.txt as "pushinsteadof". So, if a problem such as mentioned above
> arises in
> a different scenario 'insteadOf' cannot be used in it.
I was using it as a suggestion for the user's 'go look for an
alternative' step (i.e. that there may be an alternative!)
--
Philip
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] doc git: multivar configuration parameters append to existing values
2014-06-16 18:43 ` Junio C Hamano
2014-06-16 19:38 ` Philip Oakley
@ 2014-06-16 19:48 ` Jeff King
1 sibling, 0 replies; 8+ messages in thread
From: Jeff King @ 2014-06-16 19:48 UTC (permalink / raw)
To: Junio C Hamano
Cc: Philip Oakley, GitList, Ævar Arnfjörð Bjarmason,
Robert Clausecker, Alex Riesen, Tanay Abhra
On Mon, Jun 16, 2014 at 11:43:32AM -0700, Junio C Hamano wrote:
> I have two doubts, while appreciating the overall direction to
> clarify things very much.
>
> * "single overrides, multiple appends" is not a wrong explanation
> per-se, but sounds like an arbitrary rule that forces people to
> memorize. I wonder if it makes it less burdensome for readers if
> we just said "Git acts as if the given configuration is specified
> at the very end of the configuration files"---once the reader
> understands that Git reads all configuration varilables of the
> same name and the code paths that *use* one of them pick the one
> defined the last, it is easy to realize that "single overrides"
> is merely a natural consequence of the appending nature of "-c".
Yeah, I think the problem is really not one of "-c" in particular. If
you did:
git config --system remote.magic.url some-default
to provide a universal alias for the "magic" remote, you could not
override it via ~/.gitconfig or .git/config, for the same reasons.
I think we need a better discussion of multivar versus "normal"
overridable variables in config.txt, and then "-c" can make a note that
this is a potential issue, and refer readers to the right section.
I also think it would be nice to have a syntax to "reset" multivars to
their initial state (both from config files and from "-c"). Their
inability to be overridden is one of the reasons we have so few of them.
> * The last sentence added, i.e. "insteadof"-style, will not be
> understood by any reader other than those who tried to use "-c"
> on remote.*.url variables and does not belong here. A better
> way/place to give that information is needed.
Agreed. I think that could go in the discussion I mentioned above (as
"some variables have other mechanisms to accomplish the same thing,
like..."). But if we learned a mechanism for resetting multivars, such
workarounds would not be needed at all.
-Peff
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] doc git: multivar configuration parameters append to existing values
2014-06-16 19:38 ` Philip Oakley
@ 2014-06-16 21:10 ` Junio C Hamano
2014-06-17 22:03 ` Philip Oakley
0 siblings, 1 reply; 8+ messages in thread
From: Junio C Hamano @ 2014-06-16 21:10 UTC (permalink / raw)
To: Philip Oakley
Cc: GitList, Jeff King, Ævar Arnfjörð Bjarmason,
Robert Clausecker, Alex Riesen, Tanay Abhra
"Philip Oakley" <philipoakley@iee.org> writes:
>> ---once
>> the reader
>> understands that Git reads all configuration varilables of the
>> same name and the code paths that *use* one of them pick the one
>> defined the last,
> It's this step that's a concern. We shouldn't be forcing the reader to
> implicitly grok that, especially as we don't actually say it elsewhere
> (in the regular documentation).
I think that is what I was driving at. If we do not tell the reader
that, perhaps we should and everything else will fall as natural
consequence of that understanding.
>> * The last sentence added, i.e. "insteadof"-style, will not be
>> understood by any reader other than those who tried to use "-c"
>> on remote.*.url variables and does not belong here. A better
>> way/place to give that information is needed.
>
> I just wanted to indicate that some multivars do have get-out [override]
> config parameters, though we aren't consistent about their names yet,
> while giving a clue as to a typical name style.
I think those who tried "-c remote.*.url" would be helped better by
having a see-also in the documentation on "remote.*.url" that refers
them to "insteadOf" noting that "remote.*.url" is a multi-value
variable and appending different definition will not make "the last
one wins". After all "-c" is merely *one* way to append.
The next person who gets confused may say "I added remote.origin.url
at the end of my $repo/.git/config expecting that the value to be
used"; the answer would be the same "the variable is multi-valued;
adding a new value is not the right way to futz with it. You either
need to replace, or if you do not want to replace, use insteadOf".
That is the second reason why the mention of insteadOf does not
belong to the description of "-c var=value".
Perhaps something like this as a starting point?
Documentation/config.txt | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/Documentation/config.txt b/Documentation/config.txt
index 1d718bd..357cc02 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -2108,6 +2108,13 @@ remote.pushdefault::
remote.<name>.url::
The URL of a remote repository. See linkgit:git-fetch[1] or
linkgit:git-push[1].
++
+Note that this variable is multi-valued (e.g. "git push there" with
+multiple `remote.there.url` will push to all the named repositories),
+and does not follow the "last-one-survives" rule. When you want to
+temporarily redirect a push to somewhere else, see `url.<base>.insteadOf`;
+you cannot use "git -c remote.<name>.url=<temporary URL> push", because
+you will be pushing to both the configured place and the temporary place.
remote.<name>.pushurl::
The push URL of a remote repository. See linkgit:git-push[1].
@@ -2419,6 +2426,10 @@ url.<base>.insteadOf::
the best alternative for the particular user, even for a
never-before-seen repository on the site. When more than one
insteadOf strings match a given URL, the longest match is used.
++
+When you want to redirect a push to `$URL` (e.g. `site.xz:myrepo`)
+temporarily to somewhere else (e.g. `othersite.xz:myrepo`), you can
+use "git -c url.othersite.xz:myrepo.insteadOf=site.xz:myrepo push ..."
url.<base>.pushInsteadOf::
Any URL that starts with this value will not be pushed to;
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] doc git: multivar configuration parameters append to existing values
2014-06-16 21:10 ` Junio C Hamano
@ 2014-06-17 22:03 ` Philip Oakley
0 siblings, 0 replies; 8+ messages in thread
From: Philip Oakley @ 2014-06-17 22:03 UTC (permalink / raw)
To: Junio C Hamano
Cc: GitList, Jeff King, Ævar Arnfjörð Bjarmason,
Robert Clausecker, Alex Riesen, Tanay Abhra
From: "Junio C Hamano" <gitster@pobox.com>
> "Philip Oakley" <philipoakley@iee.org> writes:
>
>>> ---once
>>> the reader
>>> understands that Git reads all configuration varilables of the
>>> same name and the code paths that *use* one of them pick the one
>>> defined the last,
>> It's this step that's a concern. We shouldn't be forcing the reader
>> to
>> implicitly grok that, especially as we don't actually say it
>> elsewhere
>> (in the regular documentation).
>
> I think that is what I was driving at. If we do not tell the reader
> that, perhaps we should and everything else will fall as natural
> consequence of that understanding.
>
>>> * The last sentence added, i.e. "insteadof"-style, will not be
>>> understood by any reader other than those who tried to use "-c"
>>> on remote.*.url variables and does not belong here. A better
>>> way/place to give that information is needed.
>>
>> I just wanted to indicate that some multivars do have get-out
>> [override]
>> config parameters, though we aren't consistent about their names yet,
>> while giving a clue as to a typical name style.
>
> I think those who tried "-c remote.*.url" would be helped better by
> having a see-also in the documentation on "remote.*.url" that refers
> them to "insteadOf" noting that "remote.*.url" is a multi-value
> variable and appending different definition will not make "the last
> one wins". After all "-c" is merely *one* way to append.
>
> The next person who gets confused may say "I added remote.origin.url
> at the end of my $repo/.git/config expecting that the value to be
> used"; the answer would be the same "the variable is multi-valued;
> adding a new value is not the right way to futz with it. You either
> need to replace, or if you do not want to replace, use insteadOf".
>
> That is the second reason why the mention of insteadOf does not
> belong to the description of "-c var=value".
>
> Perhaps something like this as a starting point?
>
Yes, that's a good start, but we still need the correction to the git(1)
'-c' option text.
It'll be a few days before I can get back to this.
> Documentation/config.txt | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/Documentation/config.txt b/Documentation/config.txt
> index 1d718bd..357cc02 100644
> --- a/Documentation/config.txt
> +++ b/Documentation/config.txt
> @@ -2108,6 +2108,13 @@ remote.pushdefault::
> remote.<name>.url::
> The URL of a remote repository. See linkgit:git-fetch[1] or
> linkgit:git-push[1].
> ++
> +Note that this variable is multi-valued (e.g. "git push there" with
> +multiple `remote.there.url` will push to all the named repositories),
> +and does not follow the "last-one-survives" rule. When you want to
> +temporarily redirect a push to somewhere else, see
> `url.<base>.insteadOf`;
> +you cannot use "git -c remote.<name>.url=<temporary URL> push",
> because
> +you will be pushing to both the configured place and the temporary
> place.
>
> remote.<name>.pushurl::
> The push URL of a remote repository. See linkgit:git-push[1].
> @@ -2419,6 +2426,10 @@ url.<base>.insteadOf::
> the best alternative for the particular user, even for a
> never-before-seen repository on the site. When more than one
> insteadOf strings match a given URL, the longest match is used.
> ++
> +When you want to redirect a push to `$URL` (e.g. `site.xz:myrepo`)
> +temporarily to somewhere else (e.g. `othersite.xz:myrepo`), you can
> +use "git -c url.othersite.xz:myrepo.insteadOf=site.xz:myrepo push
> ..."
>
> url.<base>.pushInsteadOf::
> Any URL that starts with this value will not be pushed to;
>
>
--
Philip
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-06-17 22:03 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-16 12:49 [PATCH] doc git: multivar configuration parameters append to existing values Philip Oakley
2014-06-16 18:35 ` Tanay Abhra
2014-06-16 19:42 ` Philip Oakley
2014-06-16 18:43 ` Junio C Hamano
2014-06-16 19:38 ` Philip Oakley
2014-06-16 21:10 ` Junio C Hamano
2014-06-17 22:03 ` Philip Oakley
2014-06-16 19:48 ` Jeff King
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.