{"thread":{"id":"34335","subject":"[PATCH] git-config: update doc for --get with multiple values","startedAt":"2013-07-03T18:27:39Z","lastAt":"2013-07-07T19:55:18Z","messageCount":7,"participants":["John Keeping","Jeff King","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"222477","messageId":"41dc25ceac50731a7c5da753c04b7c13c41c1b51.1372876047.git.john@keeping.me.uk","threadId":"34335","inReplyTo":null,"subject":"[PATCH] git-config: update doc for --get with multiple values","fromName":"John Keeping","fromEmail":"john@keeping.me.uk","sentAt":"2013-07-03T18:27:39Z","receivedAt":"2013-07-03T18:27:39Z","isPatch":true,"sender":{"key":"john@keeping.me.uk","avatar":"https://avatars.githubusercontent.com/u/1702081?v=4"},"body":"Since commit 00b347d (git-config: do not complain about duplicate\nentries, 2012-10-23), \"git config --get\" does not exit with an error if\nthere are multiple values for the specified key but instead returns the\nlast value.  Update the documentation to reflect this.\n\nSigned-off-by: John Keeping <john@keeping.me.uk>\n---\n Documentation/git-config.txt | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/Documentation/git-config.txt b/Documentation/git-config.txt\nindex 19a7be0..fbad05e 100644\n--- a/Documentation/git-config.txt\n+++ b/Documentation/git-config.txt\n@@ -82,7 +82,7 @@ OPTIONS\n --get::\n \tGet the value for a given key (optionally filtered by a regex\n \tmatching the value). Returns error code 1 if the key was not\n-\tfound and error code 2 if multiple key values were found.\n+\tfound and the last value if multiple key values were found.\n \n --get-all::\n \tLike get, but does not fail if the number of values for the key\n-- \n1.8.3.1.747.g77f7d3a\n"},{"id":"222479","messageId":"20130703183212.GA32043@sigill.intra.peff.net","threadId":"34335","inReplyTo":"41dc25ceac50731a7c5da753c04b7c13c41c1b51.1372876047.git.john@keeping.me.uk","subject":"Re: [PATCH] git-config: update doc for --get with multiple values","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2013-07-03T18:32:12Z","receivedAt":"2013-07-03T18:32:12Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Jul 03, 2013 at 07:27:39PM +0100, John Keeping wrote:\n\n> Since commit 00b347d (git-config: do not complain about duplicate\n> entries, 2012-10-23), \"git config --get\" does not exit with an error if\n> there are multiple values for the specified key but instead returns the\n> last value.  Update the documentation to reflect this.\n\nThanks for catching this. Patch looks good.\n\nThere is another section later in the documentation which details the\nvarious exit codes and what they mean. But it seems to have never\nactually documented this case, so we don't need to update it. :)\n\n-Peff\n"},{"id":"222482","messageId":"7vd2qzfpk9.fsf@alter.siamese.dyndns.org","threadId":"34335","inReplyTo":"41dc25ceac50731a7c5da753c04b7c13c41c1b51.1372876047.git.john@keeping.me.uk","subject":"Re: [PATCH] git-config: update doc for --get with multiple values","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-07-03T18:47:50Z","receivedAt":"2013-07-03T18:47:50Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"John Keeping <john@keeping.me.uk> writes:\n\n> Since commit 00b347d (git-config: do not complain about duplicate\n> entries, 2012-10-23), \"git config --get\" does not exit with an error if\n> there are multiple values for the specified key but instead returns the\n> last value.  Update the documentation to reflect this.\n>\n> Signed-off-by: John Keeping <john@keeping.me.uk>\n> ---\n>  Documentation/git-config.txt | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/Documentation/git-config.txt b/Documentation/git-config.txt\n> index 19a7be0..fbad05e 100644\n> --- a/Documentation/git-config.txt\n> +++ b/Documentation/git-config.txt\n> @@ -82,7 +82,7 @@ OPTIONS\n>  --get::\n>  \tGet the value for a given key (optionally filtered by a regex\n>  \tmatching the value). Returns error code 1 if the key was not\n> -\tfound and error code 2 if multiple key values were found.\n> +\tfound and the last value if multiple key values were found.\n>  \n>  --get-all::\n>  \tLike get, but does not fail if the number of values for the key\n\nThanks.\n\nI wondered if we should explain the significance of \"last\" a bit\nmore (like \"this results in the value from the most specific\nconfiguration file to be used, the ones in $GIT_DIR/config\noverriding what is in $HOME/.gitconfig\"), but I do not have a strong\nopinion either way.  Let's queue this for 'maint' for now.\n"},{"id":"222730","messageId":"20130707095026.GR9161@serenity.lan","threadId":"34335","inReplyTo":"7vd2qzfpk9.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] git-config: update doc for --get with multiple values","fromName":"John Keeping","fromEmail":"john@keeping.me.uk","sentAt":"2013-07-07T09:50:26Z","receivedAt":"2013-07-07T09:50:26Z","isPatch":true,"sender":{"key":"john@keeping.me.uk","avatar":"https://avatars.githubusercontent.com/u/1702081?v=4"},"body":"On Wed, Jul 03, 2013 at 11:47:50AM -0700, Junio C Hamano wrote:\n> John Keeping <john@keeping.me.uk> writes:\n> \n> > Since commit 00b347d (git-config: do not complain about duplicate\n> > entries, 2012-10-23), \"git config --get\" does not exit with an error if\n> > there are multiple values for the specified key but instead returns the\n> > last value.  Update the documentation to reflect this.\n> >\n> > Signed-off-by: John Keeping <john@keeping.me.uk>\n> > ---\n> >  Documentation/git-config.txt | 2 +-\n> >  1 file changed, 1 insertion(+), 1 deletion(-)\n> >\n> > diff --git a/Documentation/git-config.txt b/Documentation/git-config.txt\n> > index 19a7be0..fbad05e 100644\n> > --- a/Documentation/git-config.txt\n> > +++ b/Documentation/git-config.txt\n> > @@ -82,7 +82,7 @@ OPTIONS\n> >  --get::\n> >  \tGet the value for a given key (optionally filtered by a regex\n> >  \tmatching the value). Returns error code 1 if the key was not\n> > -\tfound and error code 2 if multiple key values were found.\n> > +\tfound and the last value if multiple key values were found.\n> >  \n> >  --get-all::\n> >  \tLike get, but does not fail if the number of values for the key\n> \n> Thanks.\n> \n> I wondered if we should explain the significance of \"last\" a bit\n> more (like \"this results in the value from the most specific\n> configuration file to be used, the ones in $GIT_DIR/config\n> overriding what is in $HOME/.gitconfig\"), but I do not have a strong\n> opinion either way.  Let's queue this for 'maint' for now.\n\nI don't think that change belongs here.  How about doing something like\nthis in the FILES section (the first two hunks are just reordering the\nexisting list, only the last hunk changes the content):\n\n-- >8 --\ndiff --git a/Documentation/git-config.txt b/Documentation/git-config.txt\nindex fbad05e..99dc497 100644\n--- a/Documentation/git-config.txt\n+++ b/Documentation/git-config.txt\n@@ -206,12 +206,8 @@ FILES\n If not set explicitly with '--file', there are four files where\n 'git config' will search for configuration options:\n \n-$GIT_DIR/config::\n-\tRepository specific configuration file.\n-\n-~/.gitconfig::\n-\tUser-specific configuration file. Also called \"global\"\n-\tconfiguration file.\n+$(prefix)/etc/gitconfig::\n+\tSystem-wide configuration file.\n \n $XDG_CONFIG_HOME/git/config::\n \tSecond user-specific configuration file. If $XDG_CONFIG_HOME is not set\n@@ -221,8 +217,12 @@ $XDG_CONFIG_HOME/git/config::\n \tyou sometimes use older versions of Git, as support for this\n \tfile was added fairly recently.\n \n-$(prefix)/etc/gitconfig::\n-\tSystem-wide configuration file.\n+~/.gitconfig::\n+\tUser-specific configuration file. Also called \"global\"\n+\tconfiguration file.\n+\n+$GIT_DIR/config::\n+\tRepository specific configuration file.\n \n If no further options are given, all reading options will read all of these\n files that are available. If the global or the system-wide configuration\n@@ -230,6 +230,10 @@ file are not available they will be ignored. If the repository configuration\n file is not available or readable, 'git config' will exit with a non-zero\n error code. However, in neither case will an error message be issued.\n \n+The files are read in the order given above, with last value found taking\n+precedence over values read earlier.  When multiple values are taken then all\n+values of a key from all files will be used.\n+\n All writing options will per default write to the repository specific\n configuration file. Note that this also affects options like '--replace-all'\n and '--unset'. *'git config' will only ever change one file at a time*.\n"},{"id":"222752","messageId":"7v38rq5lad.fsf@alter.siamese.dyndns.org","threadId":"34335","inReplyTo":"20130707095026.GR9161@serenity.lan","subject":"Re: [PATCH] git-config: update doc for --get with multiple values","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-07-07T17:31:38Z","receivedAt":"2013-07-07T17:31:38Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"John Keeping <john@keeping.me.uk> writes:\n\n>> I wondered if we should explain the significance of \"last\" a bit\n>> more (like \"this results in the value from the most specific\n>> configuration file to be used, the ones in $GIT_DIR/config\n>> overriding what is in $HOME/.gitconfig\"), but I do not have a strong\n>> opinion either way.  Let's queue this for 'maint' for now.\n>\n> I don't think that change belongs here.  How about doing something like\n> this in the FILES section (the first two hunks are just reordering the\n> existing list, only the last hunk changes the content):\n\nSounds like a good change to me ;-).\n\n> -- >8 --\n> diff --git a/Documentation/git-config.txt b/Documentation/git-config.txt\n> index fbad05e..99dc497 100644\n> --- a/Documentation/git-config.txt\n> +++ b/Documentation/git-config.txt\n> @@ -206,12 +206,8 @@ FILES\n>  If not set explicitly with '--file', there are four files where\n>  'git config' will search for configuration options:\n>  \n> -$GIT_DIR/config::\n> -\tRepository specific configuration file.\n> -\n> -~/.gitconfig::\n> -\tUser-specific configuration file. Also called \"global\"\n> -\tconfiguration file.\n> +$(prefix)/etc/gitconfig::\n> +\tSystem-wide configuration file.\n>  \n>  $XDG_CONFIG_HOME/git/config::\n>  \tSecond user-specific configuration file. If $XDG_CONFIG_HOME is not set\n> @@ -221,8 +217,12 @@ $XDG_CONFIG_HOME/git/config::\n>  \tyou sometimes use older versions of Git, as support for this\n>  \tfile was added fairly recently.\n>  \n> -$(prefix)/etc/gitconfig::\n> -\tSystem-wide configuration file.\n> +~/.gitconfig::\n> +\tUser-specific configuration file. Also called \"global\"\n> +\tconfiguration file.\n> +\n> +$GIT_DIR/config::\n> +\tRepository specific configuration file.\n>  \n>  If no further options are given, all reading options will read all of these\n>  files that are available. If the global or the system-wide configuration\n> @@ -230,6 +230,10 @@ file are not available they will be ignored. If the repository configuration\n>  file is not available or readable, 'git config' will exit with a non-zero\n>  error code. However, in neither case will an error message be issued.\n>  \n> +The files are read in the order given above, with last value found taking\n> +precedence over values read earlier.  When multiple values are taken then all\n> +values of a key from all files will be used.\n> +\n>  All writing options will per default write to the repository specific\n>  configuration file. Note that this also affects options like '--replace-all'\n>  and '--unset'. *'git config' will only ever change one file at a time*.\n"},{"id":"222772","messageId":"20130707194956.GU9161@serenity.lan","threadId":"34335","inReplyTo":"7v38rq5lad.fsf@alter.siamese.dyndns.org","subject":"[PATCH] git-config(1): clarify precedence of multiple values","fromName":"John Keeping","fromEmail":"john@keeping.me.uk","sentAt":"2013-07-07T19:49:56Z","receivedAt":"2013-07-07T19:49:56Z","isPatch":true,"sender":{"key":"john@keeping.me.uk","avatar":"https://avatars.githubusercontent.com/u/1702081?v=4"},"body":"In order to clarify which value is used when there are multiple values\ndefined for a key, re-order the list of file locations so that it runs\nfrom least specific to most specific.  Then add a paragraph which simply\nsays that the last value will be used.\n\nSigned-off-by: John Keeping <john@keeping.me.uk>\n---\nOn Sun, Jul 07, 2013 at 10:31:38AM -0700, Junio C Hamano wrote:\n> John Keeping <john@keeping.me.uk> writes:\n> \n> >> I wondered if we should explain the significance of \"last\" a bit\n> >> more (like \"this results in the value from the most specific\n> >> configuration file to be used, the ones in $GIT_DIR/config\n> >> overriding what is in $HOME/.gitconfig\"), but I do not have a strong\n> >> opinion either way.  Let's queue this for 'maint' for now.\n> >\n> > I don't think that change belongs here.  How about doing something like\n> > this in the FILES section (the first two hunks are just reordering the\n> > existing list, only the last hunk changes the content):\n> \n> Sounds like a good change to me ;-).\n\nSo here it is as a proper patch :-)\n\n Documentation/git-config.txt | 20 ++++++++++++--------\n 1 file changed, 12 insertions(+), 8 deletions(-)\n\ndiff --git a/Documentation/git-config.txt b/Documentation/git-config.txt\nindex fbad05e..99dc497 100644\n--- a/Documentation/git-config.txt\n+++ b/Documentation/git-config.txt\n@@ -206,12 +206,8 @@ FILES\n If not set explicitly with '--file', there are four files where\n 'git config' will search for configuration options:\n \n-$GIT_DIR/config::\n-\tRepository specific configuration file.\n-\n-~/.gitconfig::\n-\tUser-specific configuration file. Also called \"global\"\n-\tconfiguration file.\n+$(prefix)/etc/gitconfig::\n+\tSystem-wide configuration file.\n \n $XDG_CONFIG_HOME/git/config::\n \tSecond user-specific configuration file. If $XDG_CONFIG_HOME is not set\n@@ -221,8 +217,12 @@ $XDG_CONFIG_HOME/git/config::\n \tyou sometimes use older versions of Git, as support for this\n \tfile was added fairly recently.\n \n-$(prefix)/etc/gitconfig::\n-\tSystem-wide configuration file.\n+~/.gitconfig::\n+\tUser-specific configuration file. Also called \"global\"\n+\tconfiguration file.\n+\n+$GIT_DIR/config::\n+\tRepository specific configuration file.\n \n If no further options are given, all reading options will read all of these\n files that are available. If the global or the system-wide configuration\n@@ -230,6 +230,10 @@ file are not available they will be ignored. If the repository configuration\n file is not available or readable, 'git config' will exit with a non-zero\n error code. However, in neither case will an error message be issued.\n \n+The files are read in the order given above, with last value found taking\n+precedence over values read earlier.  When multiple values are taken then all\n+values of a key from all files will be used.\n+\n All writing options will per default write to the repository specific\n configuration file. Note that this also affects options like '--replace-all'\n and '--unset'. *'git config' will only ever change one file at a time*.\n-- \n1.8.3.2.855.gbc9faed\n"},{"id":"222773","messageId":"20130707195518.GB20700@sigill.intra.peff.net","threadId":"34335","inReplyTo":"20130707194956.GU9161@serenity.lan","subject":"Re: [PATCH] git-config(1): clarify precedence of multiple values","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2013-07-07T19:55:18Z","receivedAt":"2013-07-07T19:55:18Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sun, Jul 07, 2013 at 08:49:56PM +0100, John Keeping wrote:\n\n> In order to clarify which value is used when there are multiple values\n> defined for a key, re-order the list of file locations so that it runs\n> from least specific to most specific.  Then add a paragraph which simply\n> says that the last value will be used.\n\nMakes sense.\n\n>  file is not available or readable, 'git config' will exit with a non-zero\n>  error code. However, in neither case will an error message be issued.\n>  \n> +The files are read in the order given above, with last value found taking\n> +precedence over values read earlier.  When multiple values are taken then all\n> +values of a key from all files will be used.\n\nWhat order do the values come in --get-all?\n\nIf you read carefully, I think it is implied by the \"files are read in\norder given above\", but it took me a minute to think about it. Maybe add\nat the end:\n\n  ...values of a key from all files will be shown, in the order the\n  files are processed (least specific to most specific).\n\nOr something (I do not like \"least specific\" because we have not\nintroduced that term earlier, but I can't think of another succinct way\nto say it).\n\nBut even without that, the patch is certainly an improvement.\n\n-Peff\n"}]}