{"thread":{"id":"45846","subject":"[PATCH] clone: handle empty config values in -c","startedAt":"2017-05-02T00:05:24Z","lastAt":"2017-05-02T03:11:39Z","messageCount":8,"participants":["Jonathan Nieder","Brandon Williams","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"318427","messageId":"20170502000515.GU28740@aiede.svl.corp.google.com","threadId":"45846","inReplyTo":null,"subject":"[PATCH] clone: handle empty config values in -c","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2017-05-02T00:05:15Z","receivedAt":"2017-05-02T00:05:24Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"\"git clone --config\" uses the following incantation to add an item to\na config file, instead of replacing an existing value:\n\n\tgit_config_set_multivar_gently(key, value, \"^$\", 0)\n\nAs long as no existing value matches the regex ^$, that works as\nintended and adds to the config.  When a value is empty, though, it\nreplaces the existing value.\n\nNoticed while trying to set credential.helper during a clone to use a\nspecific helper without inheriting from ~/.gitconfig and\n/etc/gitconfig.  That is, I ran\n\n\tgit clone -c credential.helper= \\\n\t\t-c credential.helper=myhelper \\\n\t\thttps://example.com/repo\n\nintending to produce the configuration\n\n\t[credential]\n\t\thelper =\n\t\thelper = myhelper\n\nWithout this patch, the 'helper =' line is not included and the\ncredential helper from /etc/gitconfig gets used.\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\nThoughts?\n\nThanks,\nJonathan\n\n builtin/clone.c         | 4 +++-\n t/t5611-clone-config.sh | 8 ++++++++\n 2 files changed, 11 insertions(+), 1 deletion(-)\n\ndiff --git a/builtin/clone.c b/builtin/clone.c\nindex de85b85254..a6ae7d6180 100644\n--- a/builtin/clone.c\n+++ b/builtin/clone.c\n@@ -773,7 +773,9 @@ static int checkout(int submodule_progress)\n \n static int write_one_config(const char *key, const char *value, void *data)\n {\n-\treturn git_config_set_multivar_gently(key, value ? value : \"true\", \"^$\", 0);\n+\treturn git_config_set_multivar_gently(key,\n+\t\t\t\t\t      value ? value : \"true\",\n+\t\t\t\t\t      CONFIG_REGEX_NONE, 0);\n }\n \n static void write_config(struct string_list *config)\ndiff --git a/t/t5611-clone-config.sh b/t/t5611-clone-config.sh\nindex e4850b778c..39329eb7a8 100755\n--- a/t/t5611-clone-config.sh\n+++ b/t/t5611-clone-config.sh\n@@ -19,6 +19,14 @@ test_expect_success 'clone -c can set multi-keys' '\n \ttest_cmp expect actual\n '\n \n+test_expect_success 'clone -c can set multi-keys, including some empty' '\n+\trm -rf child &&\n+\tgit clone -c credential.helper= -c credential.helper=hi . child &&\n+\tprintf \"%s\\n\" \"\" hi >expect &&\n+\tgit --git-dir=child/.git config --get-all credential.helper >actual &&\n+\ttest_cmp expect actual\n+'\n+\n test_expect_success 'clone -c without a value is boolean true' '\n \trm -rf child &&\n \tgit clone -c core.foo . child &&\n-- \n2.13.0.rc1.294.g07d810a77f\n\n"},{"id":"318428","messageId":"20170502000856.GI39135@google.com","threadId":"45846","inReplyTo":"20170502000515.GU28740@aiede.svl.corp.google.com","subject":"Re: [PATCH] clone: handle empty config values in -c","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2017-05-02T00:08:56Z","receivedAt":"2017-05-02T00:09:04Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"On 05/01, Jonathan Nieder wrote:\n> \"git clone --config\" uses the following incantation to add an item to\n> a config file, instead of replacing an existing value:\n> \n> \tgit_config_set_multivar_gently(key, value, \"^$\", 0)\n> \n> As long as no existing value matches the regex ^$, that works as\n> intended and adds to the config.  When a value is empty, though, it\n> replaces the existing value.\n> \n> Noticed while trying to set credential.helper during a clone to use a\n> specific helper without inheriting from ~/.gitconfig and\n> /etc/gitconfig.  That is, I ran\n> \n> \tgit clone -c credential.helper= \\\n> \t\t-c credential.helper=myhelper \\\n> \t\thttps://example.com/repo\n> \n> intending to produce the configuration\n> \n> \t[credential]\n> \t\thelper =\n> \t\thelper = myhelper\n> \n> Without this patch, the 'helper =' line is not included and the\n> credential helper from /etc/gitconfig gets used.\n> \n> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>\n> ---\n> Thoughts?\n\nAfter reading this I'm still a little fuzzy on why the empty helper line\nis needed to avoid using the credential helper from /etc/gitconfig.\n\n> \n> Thanks,\n> Jonathan\n> \n>  builtin/clone.c         | 4 +++-\n>  t/t5611-clone-config.sh | 8 ++++++++\n>  2 files changed, 11 insertions(+), 1 deletion(-)\n> \n> diff --git a/builtin/clone.c b/builtin/clone.c\n> index de85b85254..a6ae7d6180 100644\n> --- a/builtin/clone.c\n> +++ b/builtin/clone.c\n> @@ -773,7 +773,9 @@ static int checkout(int submodule_progress)\n>  \n>  static int write_one_config(const char *key, const char *value, void *data)\n>  {\n> -\treturn git_config_set_multivar_gently(key, value ? value : \"true\", \"^$\", 0);\n> +\treturn git_config_set_multivar_gently(key,\n> +\t\t\t\t\t      value ? value : \"true\",\n> +\t\t\t\t\t      CONFIG_REGEX_NONE, 0);\n>  }\n>  \n>  static void write_config(struct string_list *config)\n> diff --git a/t/t5611-clone-config.sh b/t/t5611-clone-config.sh\n> index e4850b778c..39329eb7a8 100755\n> --- a/t/t5611-clone-config.sh\n> +++ b/t/t5611-clone-config.sh\n> @@ -19,6 +19,14 @@ test_expect_success 'clone -c can set multi-keys' '\n>  \ttest_cmp expect actual\n>  '\n>  \n> +test_expect_success 'clone -c can set multi-keys, including some empty' '\n> +\trm -rf child &&\n> +\tgit clone -c credential.helper= -c credential.helper=hi . child &&\n> +\tprintf \"%s\\n\" \"\" hi >expect &&\n> +\tgit --git-dir=child/.git config --get-all credential.helper >actual &&\n> +\ttest_cmp expect actual\n> +'\n> +\n>  test_expect_success 'clone -c without a value is boolean true' '\n>  \trm -rf child &&\n>  \tgit clone -c core.foo . child &&\n> -- \n> 2.13.0.rc1.294.g07d810a77f\n> \n\n-- \nBrandon Williams\n"},{"id":"318429","messageId":"20170502002114.GV28740@aiede.svl.corp.google.com","threadId":"45846","inReplyTo":"20170502000856.GI39135@google.com","subject":"[PATCH] credential doc: make multiple-helper behavior more prominent (Re: [PATCH] clone: handle empty config values in -c)","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2017-05-02T00:21:14Z","receivedAt":"2017-05-02T00:21:22Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Subject: credential doc: make multiple-helper behavior more prominent\n\nGit's configuration system works by reading multiple configuration\nfiles in order, from general to specific:\n\n - first, the system configuration /etc/gitconfig\n - then the user's configuration (~/.gitconfig or ~/.config/git/config)\n - then the repository configuration (.git/config)\n\nFor single-valued configuration items, the latest value wins.  For\nmulti-valued configuration items, values accumulate in that order.\n\nFor example, this allows setting a credential helper globally in\n~/.gitconfig that git will try to use in all repositories, regardless\nof whether they additionally provide another helper.  This is usually\na nice thing --- e.g. I can install helpers to use my OS keychain and\nto cache credentials for a short period of time globally.\n\nSometimes people want to be able to override an inherited setting.\nFor the credential.helper setting, this is done by setting the\nconfiguration item to empty before giving it a new value.  This is\nalready documented by the documentation is hard to find ---\ngit-config(1) says to look at gitcredentials(7) and the config\nreference in gitcredentials(7) doesn't mention this issue.\n\nMove the documentation to the config reference to make it easier to\nfind.\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\nBrandon Williams wrote:\n\n>> Noticed while trying to set credential.helper during a clone to use a\n>> specific helper without inheriting from ~/.gitconfig and\n>> /etc/gitconfig.  That is, I ran\n>>\n>> \tgit clone -c credential.helper= \\\n>> \t\t-c credential.helper=myhelper \\\n>> \t\thttps://example.com/repo\n>>\n>> intending to produce the configuration\n>>\n>> \t[credential]\n>> \t\thelper =\n>> \t\thelper = myhelper\n>>\n>> Without this patch, the 'helper =' line is not included and the\n>> credential helper from /etc/gitconfig gets used.\n>>\n>> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>\n>> ---\n>> Thoughts?\n>\n> After reading this I'm still a little fuzzy on why the empty helper line\n> is needed to avoid using the credential helper from /etc/gitconfig.\n\nSee \"git help credentials\":\n\n       If there are multiple instances of the credential.helper configuration\n       variable, each helper will be tried in turn, and may provide a\n       username, password, or nothing. Once Git has acquired both a username\n       and a password, no more helpers will be tried.\n\n       If credential.helper is configured to the empty string, this resets the\n       helper list to empty (so you may override a helper set by a\n       lower-priority config file by configuring the empty-string helper,\n       followed by whatever set of helpers you would like).\n\nThat's a bit obscure, though --- I didn't find it when I looked in \"git\nhelp config\".  How about this patch?\n\nTested using 'make -C Documentation gitcredentials.7'.\n\n Documentation/gitcredentials.txt | 20 ++++++++++----------\n 1 file changed, 10 insertions(+), 10 deletions(-)\n\ndiff --git a/Documentation/gitcredentials.txt b/Documentation/gitcredentials.txt\nindex f3a75d1ce1..f970196bc1 100644\n--- a/Documentation/gitcredentials.txt\n+++ b/Documentation/gitcredentials.txt\n@@ -101,16 +101,6 @@ $ git help credential-foo\n $ git config --global credential.helper foo\n -------------------------------------------\n \n-If there are multiple instances of the `credential.helper` configuration\n-variable, each helper will be tried in turn, and may provide a username,\n-password, or nothing. Once Git has acquired both a username and a\n-password, no more helpers will be tried.\n-\n-If `credential.helper` is configured to the empty string, this resets\n-the helper list to empty (so you may override a helper set by a\n-lower-priority config file by configuring the empty-string helper,\n-followed by whatever set of helpers you would like).\n-\n \n CREDENTIAL CONTEXTS\n -------------------\n@@ -162,6 +152,16 @@ helper::\n \tshell (so, for example, setting this to `foo --option=bar` will execute\n \t`git credential-foo --option=bar` via the shell. See the manual of\n \tspecific helpers for examples of their use.\n++\n+If there are multiple instances of the `credential.helper` configuration\n+variable, each helper will be tried in turn, and may provide a username,\n+password, or nothing. Once Git has acquired both a username and a\n+password, no more helpers will be tried.\n++\n+If `credential.helper` is configured to the empty string, this resets\n+the helper list to empty (so you may override a helper set by a\n+lower-priority config file by configuring the empty-string helper,\n+followed by whatever set of helpers you would like).\n \n username::\n \n-- \n2.13.0.rc1.294.g07d810a77f\n\n"},{"id":"318430","messageId":"20170502002610.GA154031@google.com","threadId":"45846","inReplyTo":"20170502002114.GV28740@aiede.svl.corp.google.com","subject":"Re: [PATCH] credential doc: make multiple-helper behavior more prominent (Re: [PATCH] clone: handle empty config values in -c)","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2017-05-02T00:26:10Z","receivedAt":"2017-05-02T00:26:18Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"On 05/01, Jonathan Nieder wrote:\n> Subject: credential doc: make multiple-helper behavior more prominent\n> \n> Git's configuration system works by reading multiple configuration\n> files in order, from general to specific:\n> \n>  - first, the system configuration /etc/gitconfig\n>  - then the user's configuration (~/.gitconfig or ~/.config/git/config)\n>  - then the repository configuration (.git/config)\n> \n> For single-valued configuration items, the latest value wins.  For\n> multi-valued configuration items, values accumulate in that order.\n> \n> For example, this allows setting a credential helper globally in\n> ~/.gitconfig that git will try to use in all repositories, regardless\n> of whether they additionally provide another helper.  This is usually\n> a nice thing --- e.g. I can install helpers to use my OS keychain and\n> to cache credentials for a short period of time globally.\n> \n> Sometimes people want to be able to override an inherited setting.\n> For the credential.helper setting, this is done by setting the\n> configuration item to empty before giving it a new value.  This is\n> already documented by the documentation is hard to find ---\n> git-config(1) says to look at gitcredentials(7) and the config\n> reference in gitcredentials(7) doesn't mention this issue.\n> \n> Move the documentation to the config reference to make it easier to\n> find.\n> \n> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>\n> ---\n> Brandon Williams wrote:\n> \n> >> Noticed while trying to set credential.helper during a clone to use a\n> >> specific helper without inheriting from ~/.gitconfig and\n> >> /etc/gitconfig.  That is, I ran\n> >>\n> >> \tgit clone -c credential.helper= \\\n> >> \t\t-c credential.helper=myhelper \\\n> >> \t\thttps://example.com/repo\n> >>\n> >> intending to produce the configuration\n> >>\n> >> \t[credential]\n> >> \t\thelper =\n> >> \t\thelper = myhelper\n> >>\n> >> Without this patch, the 'helper =' line is not included and the\n> >> credential helper from /etc/gitconfig gets used.\n> >>\n> >> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>\n> >> ---\n> >> Thoughts?\n> >\n> > After reading this I'm still a little fuzzy on why the empty helper line\n> > is needed to avoid using the credential helper from /etc/gitconfig.\n> \n> See \"git help credentials\":\n> \n>        If there are multiple instances of the credential.helper configuration\n>        variable, each helper will be tried in turn, and may provide a\n>        username, password, or nothing. Once Git has acquired both a username\n>        and a password, no more helpers will be tried.\n> \n>        If credential.helper is configured to the empty string, this resets the\n>        helper list to empty (so you may override a helper set by a\n>        lower-priority config file by configuring the empty-string helper,\n>        followed by whatever set of helpers you would like).\n> \n> That's a bit obscure, though --- I didn't find it when I looked in \"git\n> help config\".  How about this patch?\n> \n> Tested using 'make -C Documentation gitcredentials.7'.\n> \n>  Documentation/gitcredentials.txt | 20 ++++++++++----------\n>  1 file changed, 10 insertions(+), 10 deletions(-)\n> \n> diff --git a/Documentation/gitcredentials.txt b/Documentation/gitcredentials.txt\n> index f3a75d1ce1..f970196bc1 100644\n> --- a/Documentation/gitcredentials.txt\n> +++ b/Documentation/gitcredentials.txt\n> @@ -101,16 +101,6 @@ $ git help credential-foo\n>  $ git config --global credential.helper foo\n>  -------------------------------------------\n>  \n> -If there are multiple instances of the `credential.helper` configuration\n> -variable, each helper will be tried in turn, and may provide a username,\n> -password, or nothing. Once Git has acquired both a username and a\n> -password, no more helpers will be tried.\n> -\n> -If `credential.helper` is configured to the empty string, this resets\n> -the helper list to empty (so you may override a helper set by a\n> -lower-priority config file by configuring the empty-string helper,\n> -followed by whatever set of helpers you would like).\n> -\n>  \n>  CREDENTIAL CONTEXTS\n>  -------------------\n> @@ -162,6 +152,16 @@ helper::\n>  \tshell (so, for example, setting this to `foo --option=bar` will execute\n>  \t`git credential-foo --option=bar` via the shell. See the manual of\n>  \tspecific helpers for examples of their use.\n> ++\n> +If there are multiple instances of the `credential.helper` configuration\n> +variable, each helper will be tried in turn, and may provide a username,\n> +password, or nothing. Once Git has acquired both a username and a\n> +password, no more helpers will be tried.\n> ++\n> +If `credential.helper` is configured to the empty string, this resets\n> +the helper list to empty (so you may override a helper set by a\n> +lower-priority config file by configuring the empty-string helper,\n> +followed by whatever set of helpers you would like).\n\nThanks, this clears up the confusion.\n\n>  \n>  username::\n>  \n> -- \n> 2.13.0.rc1.294.g07d810a77f\n> \n\n-- \nBrandon Williams\n"},{"id":"318432","messageId":"20170502003010.GW28740@aiede.svl.corp.google.com","threadId":"45846","inReplyTo":"20170502002114.GV28740@aiede.svl.corp.google.com","subject":"Re: [PATCH] credential doc: make multiple-helper behavior more prominent (Re: [PATCH] clone: handle empty config values in -c)","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2017-05-02T00:30:10Z","receivedAt":"2017-05-02T00:30:17Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Starting out the reviews:\n\nJonathan Nieder wrote:\n\n[...]\n> configuration item to empty before giving it a new value.  This is\n> already documented by the documentation is hard to find ---\n                     ^^\ns/by/but/\n\nSorry for the confusion.\n\n[...]\n> +++ b/Documentation/gitcredentials.txt\n[...]\n> @@ -162,6 +152,16 @@ helper::\n>  \tshell (so, for example, setting this to `foo --option=bar` will execute\n>  \t`git credential-foo --option=bar` via the shell. See the manual of\n>  \tspecific helpers for examples of their use.\n> ++\n> +If there are multiple instances of the `credential.helper` configuration\n> +variable, each helper will be tried in turn, and may provide a username,\n> +password, or nothing. Once Git has acquired both a username and a\n> +password, no more helpers will be tried.\n> ++\n> +If `credential.helper` is configured to the empty string, this resets\n> +the helper list to empty (so you may override a helper set by a\n> +lower-priority config file by configuring the empty-string helper,\n\nIt's not necessarily obvious to a new user what \"lower-priority\" means.\n\nSince this text is an example, maybe it should say something like \"so,\nfor example, you can override a helper set in /etc/gitconfig by\nconfiguring the empty-string helper followed by whatever set of\nhelpers you would like in ~/.gitconfig\".\n\nThat's orthogonal to this patch but it should be straightforward to\nroll in if it makes sense.\n\nThanks,\nJonathan\n"},{"id":"318452","messageId":"20170502025623.jhs4hyiy6gc5sv7y@sigill.intra.peff.net","threadId":"45846","inReplyTo":"20170502000515.GU28740@aiede.svl.corp.google.com","subject":"Re: [PATCH] clone: handle empty config values in -c","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-05-02T02:56:23Z","receivedAt":"2017-05-02T02:56:33Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, May 01, 2017 at 05:05:15PM -0700, Jonathan Nieder wrote:\n\n> \"git clone --config\" uses the following incantation to add an item to\n> a config file, instead of replacing an existing value:\n> \n> \tgit_config_set_multivar_gently(key, value, \"^$\", 0)\n> \n> As long as no existing value matches the regex ^$, that works as\n> intended and adds to the config.  When a value is empty, though, it\n> replaces the existing value.\n> [...]\n> ---\n> Thoughts?\n\nYeah, I think this is the exact reason we introduced CONFIG_REGEX_NONE\nin the first place. At the time we fixed \"config --add\", but \"clone -c\"\nneeds the same treatment.\n\nGrepping around, it looks like we should probably be using this in other\nplaces, too:\n\n  - writing fetch refspecs in clone\n\n  - throughout remote.c for urls and refspecs\n\nI don't think an empty variable has meaning in those places, so probably\nnobody really cares. But passing CONFIG_REGEX_NONE seems to better match\nthe original intent. And in the long run I think we probably ought to\nmake an empty \"remote.foo.url\" mean \"reset the url list to empty\", as\nwe've started to do with other multivars (like credential helpers).\n\nSo your patch looks fine, but I'd be pleased if you wanted to take it\nfurther and eradicate this \"^$\" anti-pattern through the code base.\n\n-Peff\n\nPS I notice that the documentation for \"config --add\" explicitly\n   mentions that it behaves like \"^$\". This isn't accurate anymore. We\n   should probably update that. I wondered if callers of git-config\n   would need some way to specify \"--replace-all --no-value\" or\n   something, but that is precisely what \"--add\" is. So I think it's\n   just a documentation problem.\n"},{"id":"318454","messageId":"20170502030747.k4hpmyyoapcinfap@sigill.intra.peff.net","threadId":"45846","inReplyTo":"20170502002114.GV28740@aiede.svl.corp.google.com","subject":"Re: [PATCH] credential doc: make multiple-helper behavior more prominent (Re: [PATCH] clone: handle empty config values in -c)","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-05-02T03:07:47Z","receivedAt":"2017-05-02T03:07:55Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, May 01, 2017 at 05:21:14PM -0700, Jonathan Nieder wrote:\n\n> Subject: credential doc: make multiple-helper behavior more prominent\n> \n> Git's configuration system works by reading multiple configuration\n> files in order, from general to specific:\n> \n>  - first, the system configuration /etc/gitconfig\n>  - then the user's configuration (~/.gitconfig or ~/.config/git/config)\n>  - then the repository configuration (.git/config)\n> \n> For single-valued configuration items, the latest value wins.  For\n> multi-valued configuration items, values accumulate in that order.\n> \n> For example, this allows setting a credential helper globally in\n> ~/.gitconfig that git will try to use in all repositories, regardless\n> of whether they additionally provide another helper.  This is usually\n> a nice thing --- e.g. I can install helpers to use my OS keychain and\n> to cache credentials for a short period of time globally.\n> \n> Sometimes people want to be able to override an inherited setting.\n> For the credential.helper setting, this is done by setting the\n> configuration item to empty before giving it a new value.  This is\n> already documented by the documentation is hard to find ---\n> git-config(1) says to look at gitcredentials(7) and the config\n> reference in gitcredentials(7) doesn't mention this issue.\n> \n> Move the documentation to the config reference to make it easier to\n> find.\n\nI know I am the last person in the world to criticize somebody for being\ntoo verbose in a commit message, but... :)\n\nI think this background about how multi-values are handled isn't that\nuseful here, because we're not changing anything to do with that. We're\njust moving the documentation around. So I think a more compelling\nexplanation would focus on the documentation locations. Like:\n\n  The behavior of multiple credential.helper config values is explained\n  in the rather-large \"AVOIDING REPETITION\" section of\n  gitcredentials(7), but not mentions at all in the \"CONFIGURATION\n  OPTIONS\" section. That's OK if the user is reading the manpage from\n  top to bottom, but users often don't do that. The entry for\n  credential.helper in git-config(1) points them to gitcredentials(7),\n  which would make it reasonable for them to skip straight to the\n  \"CONFIGURATION OPTIONS\" section.\n\nWith or without the suggested commit message, this looks like an\nimprovement to me.\n\n> > After reading this I'm still a little fuzzy on why the empty helper line\n> > is needed to avoid using the credential helper from /etc/gitconfig.\n> \n> See \"git help credentials\":\n> \n>        If there are multiple instances of the credential.helper configuration\n>        variable, each helper will be tried in turn, and may provide a\n>        username, password, or nothing. Once Git has acquired both a username\n>        and a password, no more helpers will be tried.\n> \n>        If credential.helper is configured to the empty string, this resets the\n>        helper list to empty (so you may override a helper set by a\n>        lower-priority config file by configuring the empty-string helper,\n>        followed by whatever set of helpers you would like).\n> \n> That's a bit obscure, though --- I didn't find it when I looked in \"git\n> help config\".  How about this patch?\n\nSo I think this looks fine, but I wonder if we should discuss multi-vars\nsome in Documentation/config.txt. It would be really nice if we could\nclaim \"the usual behavior for multi-vars is to reset the list upon\nseeing an empty entry\". But probably we should make sure more of them\nhandle that before making such a claim. :)\n\n-Peff\n"},{"id":"318455","messageId":"20170502031131.tbdhpak7g65twjxp@sigill.intra.peff.net","threadId":"45846","inReplyTo":"20170502003010.GW28740@aiede.svl.corp.google.com","subject":"Re: [PATCH] credential doc: make multiple-helper behavior more prominent (Re: [PATCH] clone: handle empty config values in -c)","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-05-02T03:11:32Z","receivedAt":"2017-05-02T03:11:39Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, May 01, 2017 at 05:30:10PM -0700, Jonathan Nieder wrote:\n\n> > @@ -162,6 +152,16 @@ helper::\n> >  \tshell (so, for example, setting this to `foo --option=bar` will execute\n> >  \t`git credential-foo --option=bar` via the shell. See the manual of\n> >  \tspecific helpers for examples of their use.\n> > ++\n> > +If there are multiple instances of the `credential.helper` configuration\n> > +variable, each helper will be tried in turn, and may provide a username,\n> > +password, or nothing. Once Git has acquired both a username and a\n> > +password, no more helpers will be tried.\n> > ++\n> > +If `credential.helper` is configured to the empty string, this resets\n> > +the helper list to empty (so you may override a helper set by a\n> > +lower-priority config file by configuring the empty-string helper,\n> \n> It's not necessarily obvious to a new user what \"lower-priority\" means.\n> \n> Since this text is an example, maybe it should say something like \"so,\n> for example, you can override a helper set in /etc/gitconfig by\n> configuring the empty-string helper followed by whatever set of\n> helpers you would like in ~/.gitconfig\".\n> \n> That's orthogonal to this patch but it should be straightforward to\n> roll in if it makes sense.\n\nI'm not sure we want to get into explaining last-one-wins versus lists\nversus list-resets for each option. The \"FILES\" section of git-config(1)\ndoes cover this, though I could well believe it doesn't go into enough\ndetail or is too hard to find (my mind is sufficiently poisoned that it\nall makes sense to me, but that says little about an average Git user).\n\nThe phrase \"lower-priority config file\" is used for push.gpgSign, too\n(though there it really does seem like repeating things that are true\nfor all the config).\n\n-Peff\n"}]}