{"thread":{"id":"51636","subject":"[PATCH 00/11] completion: complete configuration variables and values after 'git -c <TAB>'","startedAt":"2019-08-13T12:27:07Z","lastAt":"2019-08-13T12:27:22Z","messageCount":12,"participants":["SZEDER Gábor"],"isPatch":true,"patchVersion":1,"patchTotal":11},"messages":[{"id":"380366","messageId":"20190813122652.16468-1-szeder.dev@gmail.com","threadId":"51636","inReplyTo":null,"subject":"[PATCH 00/11] completion: complete configuration variables and values after 'git -c <TAB>'","fromName":"SZEDER Gábor","fromEmail":"szeder.dev@gmail.com","sentAt":"2019-08-13T12:26:41Z","receivedAt":"2019-08-13T12:27:07Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"Recently I've been writing 'git -c foo.bar ...' often enough that\ntyping our long configuration variables got annoying...\n\nSo this patch series teaches our Bash completion script to complete\nsupported configuration variables and their values after 'git -c\n<TAB>', and, while at it, after 'git clone -c <TAB>' as well.\n\n\nSZEDER Gábor (11):\n  completion: fix a typo in a comment\n  completion: complete more values of more 'color.*' configuration\n    variables\n  completion: add tests for 'git config' completion\n  completion: deduplicate configuration sections\n  completion: use 'sort -u' to deduplicate config variable names\n  completion: simplify inner 'case' pattern in __gitcomp()\n  completion: split _git_config()\n  completion: complete configuration sections and variable names for\n    'git -c'\n  completion: complete values of configuration variables after 'git -c\n    var='\n  completion: complete config variables names and values for 'git clone\n    -c'\n  completion: complete config variables and values for 'git clone\n    --config='\n\n contrib/completion/git-completion.bash | 244 ++++++++++++++++++-------\n t/t9902-completion.sh                  |  63 +++++++\n 2 files changed, 243 insertions(+), 64 deletions(-)\n\n-- \n2.23.0.rc2.350.gf4fdc32db7\n\n"},{"id":"380367","messageId":"20190813122652.16468-2-szeder.dev@gmail.com","threadId":"51636","inReplyTo":"20190813122652.16468-1-szeder.dev@gmail.com","subject":"[PATCH 01/11] completion: fix a typo in a comment","fromName":"SZEDER Gábor","fromEmail":"szeder.dev@gmail.com","sentAt":"2019-08-13T12:26:42Z","receivedAt":"2019-08-13T12:27:10Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>\n---\n contrib/completion/git-completion.bash | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex e087c4bf00..cd9d8e1940 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -524,7 +524,7 @@ __git_index_files ()\n \t\t\t# Even when a directory name itself does not contain\n \t\t\t# any special characters, it will still be quoted if\n \t\t\t# any of its (stripped) trailing path components do.\n-\t\t\t# Because of this we may have seen the same direcory\n+\t\t\t# Because of this we may have seen the same directory\n \t\t\t# both quoted and unquoted.\n \t\t\tif (p in paths)\n \t\t\t\t# We have seen the same directory unquoted,\n-- \n2.23.0.rc2.350.gf4fdc32db7\n\n"},{"id":"380368","messageId":"20190813122652.16468-3-szeder.dev@gmail.com","threadId":"51636","inReplyTo":"20190813122652.16468-1-szeder.dev@gmail.com","subject":"[PATCH 02/11] completion: complete more values of more 'color.*' configuration variables","fromName":"SZEDER Gábor","fromEmail":"szeder.dev@gmail.com","sentAt":"2019-08-13T12:26:43Z","receivedAt":"2019-08-13T12:27:11Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"Most 'color.*' configuration variables, with the sole exception of\n'color.pager', accept the same set of values, but our completion\nscript recognizes only about half of them.  We could explicitly add\nall those missing variables, but let's try to reduce future\nmaintenance burden, and use the catch-all 'color.*' pattern instead,\nso this list won't get out of sync when a similar new configuration\nvariable accepting the same values is introduced [1].\n\nFurthermore, their documentation explicitly mentions that they all\naccept the standard boolean values 'false' and 'true' as well, so list\nthese, too, among the possible values.\n\n[1] OTOH, there will be a maintenance burden if ever a new\n    'color.something' is introduced which doesn't accept the same set\n    of values.  We'll see which one happens first...\n\nSigned-off-by: SZEDER Gábor <szeder.dev@gmail.com>\n---\n\nNotes:\n    I find the documentation of these configuration variables confusing.\n    A so-called \"boolean\" (quoting the docs), that besides 'false' and\n    'true' (and their standard 0,no,1,yes and non-standard 'never'/'auto'\n    synonyms) can have a third possible value 'always', too, is, well, not\n    a boolean.\n\n contrib/completion/git-completion.bash | 9 ++++-----\n 1 file changed, 4 insertions(+), 5 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex cd9d8e1940..c59347daee 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -2277,11 +2277,6 @@ _git_config ()\n \t\t__gitcomp \"$__git_merge_strategies\"\n \t\treturn\n \t\t;;\n-\tcolor.branch|color.diff|color.interactive|\\\n-\tcolor.showbranch|color.status|color.ui)\n-\t\t__gitcomp \"always never auto\"\n-\t\treturn\n-\t\t;;\n \tcolor.pager)\n \t\t__gitcomp \"false true\"\n \t\treturn\n@@ -2293,6 +2288,10 @@ _git_config ()\n \t\t\t\"\n \t\treturn\n \t\t;;\n+\tcolor.*)\n+\t\t__gitcomp \"false true always never auto\"\n+\t\treturn\n+\t\t;;\n \tdiff.submodule)\n \t\t__gitcomp \"$__git_diff_submodule_formats\"\n \t\treturn\n-- \n2.23.0.rc2.350.gf4fdc32db7\n\n"},{"id":"380369","messageId":"20190813122652.16468-5-szeder.dev@gmail.com","threadId":"51636","inReplyTo":"20190813122652.16468-1-szeder.dev@gmail.com","subject":"[PATCH 04/11] completion: deduplicate configuration sections","fromName":"SZEDER Gábor","fromEmail":"szeder.dev@gmail.com","sentAt":"2019-08-13T12:26:45Z","receivedAt":"2019-08-13T12:27:12Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"The number of configuration variables listed by the completion script\ngrew quite when we started to auto-generate it from the documentation\n[1], so we now complete them in two steps: first we list only the\nsection names, then the rest [2].  To get the section names we simply\nstrip everything following the first dot in each variable name,\nresulting in a lot of repeated section names, because most sections\ncontain more than one configuration variable.  This is not a\ncorrectness issue in practice, because Bash's completion facilities\nremove all repetitions anyway, but these repetitions make testing a\nbit harder.\n\nReplace the small 'sed' script removing subsections and variable names\nwith an 'awk' script that does the same, and in addition removes any\nrepeated configuration sections as well (by first creating and filling\nan associative array indexed by all encountered configuration\nsections, and then iterating over this array and printing the indices,\ni.e. the unique section names).  This change makes the failing 'git\nconfig - section' test in 't9902-completion.sh' pass.\n\nNote that this changes the order of section names in the output, and\nmakes it downright undeterministic, but this is not an issue, because\nBash sorts them before presenting them to the user, and our completion\ntests sort them as well before comparing with the expected output.\n\nYeah, it would be simpler and shorter to just append '| sort -u' to\nthat command, but that would incur the overhead of one more external\nprocess and pipeline stage every time a user completes configuration\nsections.\n\n[1] e17ca92637 (completion: drop the hard coded list of config vars,\n    2018-05-26)\n[2] f22f682695 (completion: complete general config vars in two steps,\n    2018-05-27)\n\nSigned-off-by: SZEDER Gábor <szeder.dev@gmail.com>\n---\n contrib/completion/git-completion.bash | 10 +++++++++-\n t/t9902-completion.sh                  |  2 +-\n 2 files changed, 10 insertions(+), 2 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex c59347daee..f89324d84f 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -2398,7 +2398,15 @@ _git_config ()\n \t\t;;\n \t*)\n \t\t__git_compute_config_vars\n-\t\t__gitcomp \"$(echo \"$__git_config_vars\" | sed 's/\\.[^ ]*/./g')\"\n+\t\t__gitcomp \"$(echo \"$__git_config_vars\" |\n+\t\t\t\tawk -F . '{\n+\t\t\t\t\tsections[$1] = 1\n+\t\t\t\t}\n+\t\t\t\tEND {\n+\t\t\t\t\tfor (s in sections)\n+\t\t\t\t\t\tprint s \".\"\n+\t\t\t\t}\n+\t\t\t\t')\"\n \tesac\n }\n \ndiff --git a/t/t9902-completion.sh b/t/t9902-completion.sh\nindex e15be1164d..008fba7c89 100755\n--- a/t/t9902-completion.sh\n+++ b/t/t9902-completion.sh\n@@ -1698,7 +1698,7 @@ do\n \t'\n done\n \n-test_expect_failure 'git config - section' '\n+test_expect_success 'git config - section' '\n \ttest_completion \"git config br\" <<-\\EOF\n \tbranch.Z\n \tbrowser.Z\n-- \n2.23.0.rc2.350.gf4fdc32db7\n\n"},{"id":"380370","messageId":"20190813122652.16468-4-szeder.dev@gmail.com","threadId":"51636","inReplyTo":"20190813122652.16468-1-szeder.dev@gmail.com","subject":"[PATCH 03/11] completion: add tests for 'git config' completion","fromName":"SZEDER Gábor","fromEmail":"szeder.dev@gmail.com","sentAt":"2019-08-13T12:26:44Z","receivedAt":"2019-08-13T12:27:12Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"The next patches will change/refactor the way we complete\nconfiguration variable names and values, so add a few tests to cover\nthe basics, namely the completion of matching configuration sections,\nfull variable names, and their values.\n\nNote that the test checking the completion of configuration sections\nis currently failing, though it's not a sign of an actual bug.  If a\nsection contains multiple variables, then that section is currently\nrepeated as many times as the number of variables in there.  This is\nnot a correctness issue in practice, because Bash's completion\nfacilities remove all repetitions anyway.  Consequently, we could list\nall those repeated sections in the expected output of this test as\nwell, but then it would have to be updated whenever a new\nconfiguration variable is added to those sections.  Instead, list each\nmatching configuration section only once, mark the test as failing for\nnow, and the next patch will update the completion script to avoid\nthose repetitions.\n\nSigned-off-by: SZEDER Gábor <szeder.dev@gmail.com>\n---\n t/t9902-completion.sh | 21 +++++++++++++++++++++\n 1 file changed, 21 insertions(+)\n\ndiff --git a/t/t9902-completion.sh b/t/t9902-completion.sh\nindex 75512c3403..e15be1164d 100755\n--- a/t/t9902-completion.sh\n+++ b/t/t9902-completion.sh\n@@ -1698,6 +1698,27 @@ do\n \t'\n done\n \n+test_expect_failure 'git config - section' '\n+\ttest_completion \"git config br\" <<-\\EOF\n+\tbranch.Z\n+\tbrowser.Z\n+\tEOF\n+'\n+\n+test_expect_success 'git config - variable name' '\n+\ttest_completion \"git config log.d\" <<-\\EOF\n+\tlog.date Z\n+\tlog.decorate Z\n+\tEOF\n+'\n+\n+test_expect_success 'git config - value' '\n+\ttest_completion \"git config color.pager \" <<-\\EOF\n+\tfalse Z\n+\ttrue Z\n+\tEOF\n+'\n+\n test_expect_success 'sourcing the completion script clears cached commands' '\n \t__git_compute_all_commands &&\n \tverbose test -n \"$__git_all_commands\" &&\n-- \n2.23.0.rc2.350.gf4fdc32db7\n\n"},{"id":"380371","messageId":"20190813122652.16468-6-szeder.dev@gmail.com","threadId":"51636","inReplyTo":"20190813122652.16468-1-szeder.dev@gmail.com","subject":"[PATCH 05/11] completion: use 'sort -u' to deduplicate config variable names","fromName":"SZEDER Gábor","fromEmail":"szeder.dev@gmail.com","sentAt":"2019-08-13T12:26:46Z","receivedAt":"2019-08-13T12:27:14Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"The completion script runs the classic '| sort | uniq' pipeline to\ndeduplicate the output of 'git help --config-for-completion'.  'sort\n-u' does the same, but uses one less external process and pipeline\nstage.  Not a bit win, as it's only run once as the list of supported\nconfiguration variables is initialized, but at least it sets a better\nexample for others to follow.\n\nSigned-off-by: SZEDER Gábor <szeder.dev@gmail.com>\n---\n contrib/completion/git-completion.bash | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex f89324d84f..b51cb31ea1 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -2225,7 +2225,7 @@ __git_config_vars=\n __git_compute_config_vars ()\n {\n \ttest -n \"$__git_config_vars\" ||\n-\t__git_config_vars=\"$(git help --config-for-completion | sort | uniq)\"\n+\t__git_config_vars=\"$(git help --config-for-completion | sort -u)\"\n }\n \n _git_config ()\n-- \n2.23.0.rc2.350.gf4fdc32db7\n\n"},{"id":"380372","messageId":"20190813122652.16468-8-szeder.dev@gmail.com","threadId":"51636","inReplyTo":"20190813122652.16468-1-szeder.dev@gmail.com","subject":"[PATCH 07/11] completion: split _git_config()","fromName":"SZEDER Gábor","fromEmail":"szeder.dev@gmail.com","sentAt":"2019-08-13T12:26:48Z","receivedAt":"2019-08-13T12:27:17Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"_git_config() contains two enormous case statements, one to complete\nconfiguration sections and variable names, and the other to complete\ntheir values.\n\nSplit these out into two separate helper functions, so in the next\npatches we can use them to implement completion for 'git -c <TAB>'.\n\nSigned-off-by: SZEDER Gábor <szeder.dev@gmail.com>\n---\n contrib/completion/git-completion.bash | 39 ++++++++++++++++++++------\n 1 file changed, 30 insertions(+), 9 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex fc437bf3eb..3e9c5b6b71 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -2228,7 +2228,8 @@ __git_compute_config_vars ()\n \t__git_config_vars=\"$(git help --config-for-completion | sort -u)\"\n }\n \n-_git_config ()\n+# Completes possible values of various configuration variables.\n+__git_complete_config_variable_value ()\n {\n \tlocal varname\n \n@@ -2320,19 +2321,16 @@ _git_config ()\n \t\t__gitcomp \"7bit 8bit quoted-printable base64\"\n \t\treturn\n \t\t;;\n-\t--get|--get-all|--unset|--unset-all)\n-\t\t__gitcomp_nl \"$(__git_config_get_set_variables)\"\n-\t\treturn\n-\t\t;;\n \t*.*)\n \t\treturn\n \t\t;;\n \tesac\n+}\n+\n+# Completes configuration sections, subsections, variable names.\n+__git_complete_config_variable_name ()\n+{\n \tcase \"$cur\" in\n-\t--*)\n-\t\t__gitcomp_builtin config\n-\t\treturn\n-\t\t;;\n \tbranch.*.*)\n \t\tlocal pfx=\"${cur%.*}.\" cur_=\"${cur##*.}\"\n \t\t__gitcomp \"remote pushRemote merge mergeOptions rebase\" \"$pfx\" \"$cur_\"\n@@ -2407,6 +2405,29 @@ _git_config ()\n \t\t\t\t\t\tprint s \".\"\n \t\t\t\t}\n \t\t\t\t')\"\n+\t\t;;\n+\tesac\n+}\n+\n+_git_config ()\n+{\n+\tcase \"$prev\" in\n+\t--get|--get-all|--unset|--unset-all)\n+\t\t__gitcomp_nl \"$(__git_config_get_set_variables)\"\n+\t\treturn\n+\t\t;;\n+\t*.*)\n+\t\t__git_complete_config_variable_value\n+\t\treturn\n+\t\t;;\n+\tesac\n+\tcase \"$cur\" in\n+\t--*)\n+\t\t__gitcomp_builtin config\n+\t\t;;\n+\t*)\n+\t\t__git_complete_config_variable_name\n+\t\t;;\n \tesac\n }\n \n-- \n2.23.0.rc2.350.gf4fdc32db7\n\n"},{"id":"380373","messageId":"20190813122652.16468-7-szeder.dev@gmail.com","threadId":"51636","inReplyTo":"20190813122652.16468-1-szeder.dev@gmail.com","subject":"[PATCH 06/11] completion: simplify inner 'case' pattern in __gitcomp()","fromName":"SZEDER Gábor","fromEmail":"szeder.dev@gmail.com","sentAt":"2019-08-13T12:26:47Z","receivedAt":"2019-08-13T12:27:18Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"The second '*' in the '--*=*' pattern of the inner 'case' statement of\nthe __gitcomp() helper function never matches anything, so let's use\n'--*=' instead.\n\nThe purpose of that inner case statement is to decide when to append a\ntrailing space to the listed options and when not.  When an option\nrequires a stuck argument, i.e. '--option=', then the trailing space\nshould not be added, so the user can continue typing the required\nargument right away.  That '--*=*' pattern is supposed to match these\noptions, but for this purpose that second '*' is unnecessary, a '--*='\npattern works just as well.  That second '*' would only make a\ndifference in case of a possible completion word like\n'--option=value', but our completion script never passes such a word\nto __gitcomp(), because the '--option=' and its 'value' must be\ncompleted separately.\n\nSigned-off-by: SZEDER Gábor <szeder.dev@gmail.com>\n---\n contrib/completion/git-completion.bash | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex b51cb31ea1..fc437bf3eb 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -340,7 +340,7 @@ __gitcomp ()\n \t\t\tc=\"$c${4-}\"\n \t\t\tif [[ $c == \"$cur_\"* ]]; then\n \t\t\t\tcase $c in\n-\t\t\t\t--*=*|*.) ;;\n+\t\t\t\t--*=|*.) ;;\n \t\t\t\t*) c=\"$c \" ;;\n \t\t\t\tesac\n \t\t\t\tCOMPREPLY[i++]=\"${2-}$c\"\n@@ -360,7 +360,7 @@ __gitcomp ()\n \t\t\tc=\"$c${4-}\"\n \t\t\tif [[ $c == \"$cur_\"* ]]; then\n \t\t\t\tcase $c in\n-\t\t\t\t--*=*|*.) ;;\n+\t\t\t\t--*=|*.) ;;\n \t\t\t\t*) c=\"$c \" ;;\n \t\t\t\tesac\n \t\t\t\tCOMPREPLY[i++]=\"${2-}$c\"\n-- \n2.23.0.rc2.350.gf4fdc32db7\n\n"},{"id":"380374","messageId":"20190813122652.16468-9-szeder.dev@gmail.com","threadId":"51636","inReplyTo":"20190813122652.16468-1-szeder.dev@gmail.com","subject":"[PATCH 08/11] completion: complete configuration sections and variable names for 'git -c'","fromName":"SZEDER Gábor","fromEmail":"szeder.dev@gmail.com","sentAt":"2019-08-13T12:26:49Z","receivedAt":"2019-08-13T12:27:18Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"'git config' expects a configuration variable's name and value in\nseparate arguments, so we let the __gitcomp() helper append a space\ncharacter to each variable name by default, like we do for most other\nthings (--options, refs, paths, etc.).  'git -c', however, expects\nthem in a single option joined by a '=' character, i.e.\n'section.name=value', so we should append a '=' character to each\nfully completed variable name, but no space, so the user can continue\ntyping the value right away.\n\nAdd an option to the __git_complete_config_variable_name() function to\nallow callers to specify an alternate suffix to add, and use it to\nappend that '=' character to configuration variables.  Update the\n__gitcomp() helper function to not append a trailing space to any\ncompletion words ending with a '=', not just to those option with a\nstuck argument.\n\nSigned-off-by: SZEDER Gábor <szeder.dev@gmail.com>\n---\n contrib/completion/git-completion.bash | 59 ++++++++++++++++++++------\n t/t9902-completion.sh                  | 14 ++++++\n 2 files changed, 60 insertions(+), 13 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 3e9c5b6b71..367b1c50f4 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -360,7 +360,7 @@ __gitcomp ()\n \t\t\tc=\"$c${4-}\"\n \t\t\tif [[ $c == \"$cur_\"* ]]; then\n \t\t\t\tcase $c in\n-\t\t\t\t--*=|*.) ;;\n+\t\t\t\t*=|*.) ;;\n \t\t\t\t*) c=\"$c \" ;;\n \t\t\t\tesac\n \t\t\t\tCOMPREPLY[i++]=\"${2-}$c\"\n@@ -2328,18 +2328,33 @@ __git_complete_config_variable_value ()\n }\n \n # Completes configuration sections, subsections, variable names.\n+#\n+# Usage: __git_complete_config_variable_name [<option>]...\n+# --sfx=<suffix>: A suffix to be appended to each fully completed\n+#                 configuration variable name (but not to sections or\n+#                 subsections) instead of the default space.\n __git_complete_config_variable_name ()\n {\n+\tlocal sfx\n+\n+\twhile test $# != 0; do\n+\t\tcase \"$1\" in\n+\t\t--sfx=*)\tsfx=\"${1##--sfx=}\" ;;\n+\t\t*)\t\treturn 1 ;;\n+\t\tesac\n+\t\tshift\n+\tdone\n+\n \tcase \"$cur\" in\n \tbranch.*.*)\n \t\tlocal pfx=\"${cur%.*}.\" cur_=\"${cur##*.}\"\n-\t\t__gitcomp \"remote pushRemote merge mergeOptions rebase\" \"$pfx\" \"$cur_\"\n+\t\t__gitcomp \"remote pushRemote merge mergeOptions rebase\" \"$pfx\" \"$cur_\" \"$sfx\"\n \t\treturn\n \t\t;;\n \tbranch.*)\n \t\tlocal pfx=\"${cur%.*}.\" cur_=\"${cur#*.}\"\n \t\t__gitcomp_direct \"$(__git_heads \"$pfx\" \"$cur_\" \".\")\"\n-\t\t__gitcomp_nl_append $'autoSetupMerge\\nautoSetupRebase\\n' \"$pfx\" \"$cur_\"\n+\t\t__gitcomp_nl_append $'autoSetupMerge\\nautoSetupRebase\\n' \"$pfx\" \"$cur_\" \"$sfx\"\n \t\treturn\n \t\t;;\n \tguitool.*.*)\n@@ -2347,28 +2362,28 @@ __git_complete_config_variable_name ()\n \t\t__gitcomp \"\n \t\t\targPrompt cmd confirm needsFile noConsole noRescan\n \t\t\tprompt revPrompt revUnmerged title\n-\t\t\t\" \"$pfx\" \"$cur_\"\n+\t\t\t\" \"$pfx\" \"$cur_\" \"$sfx\"\n \t\treturn\n \t\t;;\n \tdifftool.*.*)\n \t\tlocal pfx=\"${cur%.*}.\" cur_=\"${cur##*.}\"\n-\t\t__gitcomp \"cmd path\" \"$pfx\" \"$cur_\"\n+\t\t__gitcomp \"cmd path\" \"$pfx\" \"$cur_\" \"$sfx\"\n \t\treturn\n \t\t;;\n \tman.*.*)\n \t\tlocal pfx=\"${cur%.*}.\" cur_=\"${cur##*.}\"\n-\t\t__gitcomp \"cmd path\" \"$pfx\" \"$cur_\"\n+\t\t__gitcomp \"cmd path\" \"$pfx\" \"$cur_\" \"$sfx\"\n \t\treturn\n \t\t;;\n \tmergetool.*.*)\n \t\tlocal pfx=\"${cur%.*}.\" cur_=\"${cur##*.}\"\n-\t\t__gitcomp \"cmd path trustExitCode\" \"$pfx\" \"$cur_\"\n+\t\t__gitcomp \"cmd path trustExitCode\" \"$pfx\" \"$cur_\" \"$sfx\"\n \t\treturn\n \t\t;;\n \tpager.*)\n \t\tlocal pfx=\"${cur%.*}.\" cur_=\"${cur#*.}\"\n \t\t__git_compute_all_commands\n-\t\t__gitcomp_nl \"$__git_all_commands\" \"$pfx\" \"$cur_\"\n+\t\t__gitcomp_nl \"$__git_all_commands\" \"$pfx\" \"$cur_\" \"$sfx\"\n \t\treturn\n \t\t;;\n \tremote.*.*)\n@@ -2376,23 +2391,23 @@ __git_complete_config_variable_name ()\n \t\t__gitcomp \"\n \t\t\turl proxy fetch push mirror skipDefaultUpdate\n \t\t\treceivepack uploadpack tagOpt pushurl\n-\t\t\t\" \"$pfx\" \"$cur_\"\n+\t\t\t\" \"$pfx\" \"$cur_\" \"$sfx\"\n \t\treturn\n \t\t;;\n \tremote.*)\n \t\tlocal pfx=\"${cur%.*}.\" cur_=\"${cur#*.}\"\n \t\t__gitcomp_nl \"$(__git_remotes)\" \"$pfx\" \"$cur_\" \".\"\n-\t\t__gitcomp_nl_append \"pushDefault\" \"$pfx\" \"$cur_\"\n+\t\t__gitcomp_nl_append \"pushDefault\" \"$pfx\" \"$cur_\" \"$sfx\"\n \t\treturn\n \t\t;;\n \turl.*.*)\n \t\tlocal pfx=\"${cur%.*}.\" cur_=\"${cur##*.}\"\n-\t\t__gitcomp \"insteadOf pushInsteadOf\" \"$pfx\" \"$cur_\"\n+\t\t__gitcomp \"insteadOf pushInsteadOf\" \"$pfx\" \"$cur_\" \"$sfx\"\n \t\treturn\n \t\t;;\n \t*.*)\n \t\t__git_compute_config_vars\n-\t\t__gitcomp \"$__git_config_vars\"\n+\t\t__gitcomp \"$__git_config_vars\" \"\" \"$cur\" \"$sfx\"\n \t\t;;\n \t*)\n \t\t__git_compute_config_vars\n@@ -2409,6 +2424,20 @@ __git_complete_config_variable_name ()\n \tesac\n }\n \n+# Completes '='-separated configuration sections/variable names and values\n+# for 'git -c section.name=value'.\n+__git_complete_config_variable_name_and_value ()\n+{\n+\tcase \"$cur\" in\n+\t*=*)\n+\t\t# in the next patch...\n+\t\t;;\n+\t*)\n+\t\t__git_complete_config_variable_name --sfx='='\n+\t\t;;\n+\tesac\n+}\n+\n _git_config ()\n {\n \tcase \"$prev\" in\n@@ -2984,7 +3013,11 @@ __git_main ()\n \t\t\t# Bash filename completion\n \t\t\treturn\n \t\t\t;;\n-\t\t-c|--namespace)\n+\t\t-c)\n+\t\t\t__git_complete_config_variable_name_and_value\n+\t\t\treturn\n+\t\t\t;;\n+\t\t--namespace)\n \t\t\t# we don't support completing these options' arguments\n \t\t\treturn\n \t\t\t;;\ndiff --git a/t/t9902-completion.sh b/t/t9902-completion.sh\nindex 008fba7c89..bf60a11fa8 100755\n--- a/t/t9902-completion.sh\n+++ b/t/t9902-completion.sh\n@@ -1719,6 +1719,20 @@ test_expect_success 'git config - value' '\n \tEOF\n '\n \n+test_expect_success 'git -c - section' '\n+\ttest_completion \"git -c br\" <<-\\EOF\n+\tbranch.Z\n+\tbrowser.Z\n+\tEOF\n+'\n+\n+test_expect_success 'git -c - variable name' '\n+\ttest_completion \"git -c log.d\" <<-\\EOF\n+\tlog.date=Z\n+\tlog.decorate=Z\n+\tEOF\n+'\n+\n test_expect_success 'sourcing the completion script clears cached commands' '\n \t__git_compute_all_commands &&\n \tverbose test -n \"$__git_all_commands\" &&\n-- \n2.23.0.rc2.350.gf4fdc32db7\n\n"},{"id":"380375","messageId":"20190813122652.16468-12-szeder.dev@gmail.com","threadId":"51636","inReplyTo":"20190813122652.16468-1-szeder.dev@gmail.com","subject":"[PATCH 11/11] completion: complete config variables and values for 'git clone --config='","fromName":"SZEDER Gábor","fromEmail":"szeder.dev@gmail.com","sentAt":"2019-08-13T12:26:52Z","receivedAt":"2019-08-13T12:27:20Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"Completing configuration sections and variable names for the stuck\nargument of 'git clone --config=<TAB>' requires a bit of extra care\ncompared to doing the same for the unstuck argument of 'git clone\n--config <TAB>', because we have to deal with that '--config=' being\npart of the current word to be completed.\n\nAdd an option to the __git_complete_config_variable_name_and_value()\nand in turn to the __git_complete_config_variable_name() helper\nfunctions to specify the current section/variable name to be\ncompleted, so they can be used even when completing the stuck argument\nof '--config='.\n\n__git_complete_config_variable_value() already has such an option, and\nthus no further changes were necessary to complete possible values\nafter 'git clone --config=section.name=<TAB>'.\n\nSigned-off-by: SZEDER Gábor <szeder.dev@gmail.com>\n---\n contrib/completion/git-completion.bash | 66 +++++++++++++++++++-------\n t/t9902-completion.sh                  | 21 ++++++++\n 2 files changed, 70 insertions(+), 17 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 279f04df87..ce7ff0a96d 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -1406,6 +1406,11 @@ _git_clone ()\n \t\t;;\n \tesac\n \tcase \"$cur\" in\n+\t--config=*)\n+\t\t__git_complete_config_variable_name_and_value \\\n+\t\t\t--cur=\"${cur##--config=}\"\n+\t\treturn\n+\t\t;;\n \t--*)\n \t\t__gitcomp_builtin clone\n \t\treturn\n@@ -2352,35 +2357,41 @@ __git_complete_config_variable_value ()\n # Completes configuration sections, subsections, variable names.\n #\n # Usage: __git_complete_config_variable_name [<option>]...\n+# --cur=<word>: The current configuration section/variable name to be\n+#               completed.  Defaults to the current word to be completed.\n # --sfx=<suffix>: A suffix to be appended to each fully completed\n #                 configuration variable name (but not to sections or\n #                 subsections) instead of the default space.\n __git_complete_config_variable_name ()\n {\n-\tlocal sfx\n+\tlocal cur_=\"$cur\" sfx\n \n \twhile test $# != 0; do\n \t\tcase \"$1\" in\n+\t\t--cur=*)\tcur_=\"${1##--cur=}\" ;;\n \t\t--sfx=*)\tsfx=\"${1##--sfx=}\" ;;\n \t\t*)\t\treturn 1 ;;\n \t\tesac\n \t\tshift\n \tdone\n \n-\tcase \"$cur\" in\n+\tcase \"$cur_\" in\n \tbranch.*.*)\n-\t\tlocal pfx=\"${cur%.*}.\" cur_=\"${cur##*.}\"\n+\t\tlocal pfx=\"${cur_%.*}.\"\n+\t\tcur_=\"${cur_##*.}\"\n \t\t__gitcomp \"remote pushRemote merge mergeOptions rebase\" \"$pfx\" \"$cur_\" \"$sfx\"\n \t\treturn\n \t\t;;\n \tbranch.*)\n-\t\tlocal pfx=\"${cur%.*}.\" cur_=\"${cur#*.}\"\n+\t\tlocal pfx=\"${cur%.*}.\"\n+\t\tcur_=\"${cur#*.}\"\n \t\t__gitcomp_direct \"$(__git_heads \"$pfx\" \"$cur_\" \".\")\"\n \t\t__gitcomp_nl_append $'autoSetupMerge\\nautoSetupRebase\\n' \"$pfx\" \"$cur_\" \"$sfx\"\n \t\treturn\n \t\t;;\n \tguitool.*.*)\n-\t\tlocal pfx=\"${cur%.*}.\" cur_=\"${cur##*.}\"\n+\t\tlocal pfx=\"${cur_%.*}.\"\n+\t\tcur_=\"${cur_##*.}\"\n \t\t__gitcomp \"\n \t\t\targPrompt cmd confirm needsFile noConsole noRescan\n \t\t\tprompt revPrompt revUnmerged title\n@@ -2388,28 +2399,33 @@ __git_complete_config_variable_name ()\n \t\treturn\n \t\t;;\n \tdifftool.*.*)\n-\t\tlocal pfx=\"${cur%.*}.\" cur_=\"${cur##*.}\"\n+\t\tlocal pfx=\"${cur_%.*}.\"\n+\t\tcur_=\"${cur_##*.}\"\n \t\t__gitcomp \"cmd path\" \"$pfx\" \"$cur_\" \"$sfx\"\n \t\treturn\n \t\t;;\n \tman.*.*)\n-\t\tlocal pfx=\"${cur%.*}.\" cur_=\"${cur##*.}\"\n+\t\tlocal pfx=\"${cur_%.*}.\"\n+\t\tcur_=\"${cur_##*.}\"\n \t\t__gitcomp \"cmd path\" \"$pfx\" \"$cur_\" \"$sfx\"\n \t\treturn\n \t\t;;\n \tmergetool.*.*)\n-\t\tlocal pfx=\"${cur%.*}.\" cur_=\"${cur##*.}\"\n+\t\tlocal pfx=\"${cur_%.*}.\"\n+\t\tcur_=\"${cur_##*.}\"\n \t\t__gitcomp \"cmd path trustExitCode\" \"$pfx\" \"$cur_\" \"$sfx\"\n \t\treturn\n \t\t;;\n \tpager.*)\n-\t\tlocal pfx=\"${cur%.*}.\" cur_=\"${cur#*.}\"\n+\t\tlocal pfx=\"${cur_%.*}.\"\n+\t\tcur_=\"${cur_#*.}\"\n \t\t__git_compute_all_commands\n \t\t__gitcomp_nl \"$__git_all_commands\" \"$pfx\" \"$cur_\" \"$sfx\"\n \t\treturn\n \t\t;;\n \tremote.*.*)\n-\t\tlocal pfx=\"${cur%.*}.\" cur_=\"${cur##*.}\"\n+\t\tlocal pfx=\"${cur_%.*}.\"\n+\t\tcur_=\"${cur_##*.}\"\n \t\t__gitcomp \"\n \t\t\turl proxy fetch push mirror skipDefaultUpdate\n \t\t\treceivepack uploadpack tagOpt pushurl\n@@ -2417,19 +2433,21 @@ __git_complete_config_variable_name ()\n \t\treturn\n \t\t;;\n \tremote.*)\n-\t\tlocal pfx=\"${cur%.*}.\" cur_=\"${cur#*.}\"\n+\t\tlocal pfx=\"${cur_%.*}.\"\n+\t\tcur_=\"${cur_#*.}\"\n \t\t__gitcomp_nl \"$(__git_remotes)\" \"$pfx\" \"$cur_\" \".\"\n \t\t__gitcomp_nl_append \"pushDefault\" \"$pfx\" \"$cur_\" \"$sfx\"\n \t\treturn\n \t\t;;\n \turl.*.*)\n-\t\tlocal pfx=\"${cur%.*}.\" cur_=\"${cur##*.}\"\n+\t\tlocal pfx=\"${cur_%.*}.\"\n+\t\tcur_=\"${cur_##*.}\"\n \t\t__gitcomp \"insteadOf pushInsteadOf\" \"$pfx\" \"$cur_\" \"$sfx\"\n \t\treturn\n \t\t;;\n \t*.*)\n \t\t__git_compute_config_vars\n-\t\t__gitcomp \"$__git_config_vars\" \"\" \"$cur\" \"$sfx\"\n+\t\t__gitcomp \"$__git_config_vars\" \"\" \"$cur_\" \"$sfx\"\n \t\t;;\n \t*)\n \t\t__git_compute_config_vars\n@@ -2441,22 +2459,36 @@ __git_complete_config_variable_name ()\n \t\t\t\t\tfor (s in sections)\n \t\t\t\t\t\tprint s \".\"\n \t\t\t\t}\n-\t\t\t\t')\"\n+\t\t\t\t')\" \"\" \"$cur_\"\n \t\t;;\n \tesac\n }\n \n # Completes '='-separated configuration sections/variable names and values\n # for 'git -c section.name=value'.\n+#\n+# Usage: __git_complete_config_variable_name_and_value [<option>]...\n+# --cur=<word>: The current configuration section/variable name/value to be\n+#               completed. Defaults to the current word to be completed.\n __git_complete_config_variable_name_and_value ()\n {\n-\tcase \"$cur\" in\n+\tlocal cur_=\"$cur\"\n+\n+\twhile test $# != 0; do\n+\t\tcase \"$1\" in\n+\t\t--cur=*)\tcur_=\"${1##--cur=}\" ;;\n+\t\t*)\t\treturn 1 ;;\n+\t\tesac\n+\t\tshift\n+\tdone\n+\n+\tcase \"$cur_\" in\n \t*=*)\n \t\t__git_complete_config_variable_value \\\n-\t\t\t--varname=\"${cur%%=*}\" --cur=\"${cur#*=}\"\n+\t\t\t--varname=\"${cur_%%=*}\" --cur=\"${cur_#*=}\"\n \t\t;;\n \t*)\n-\t\t__git_complete_config_variable_name --sfx='='\n+\t\t__git_complete_config_variable_name --cur=\"$cur_\" --sfx='='\n \t\t;;\n \tesac\n }\ndiff --git a/t/t9902-completion.sh b/t/t9902-completion.sh\nindex 9e90a64830..5d98d66dbd 100755\n--- a/t/t9902-completion.sh\n+++ b/t/t9902-completion.sh\n@@ -1740,6 +1740,27 @@ test_expect_success 'git -c - value' '\n \tEOF\n '\n \n+test_expect_success 'git clone --config= - section' '\n+\ttest_completion \"git clone --config=br\" <<-\\EOF\n+\tbranch.Z\n+\tbrowser.Z\n+\tEOF\n+'\n+\n+test_expect_success 'git clone --config= - variable name' '\n+\ttest_completion \"git clone --config=log.d\" <<-\\EOF\n+\tlog.date=Z\n+\tlog.decorate=Z\n+\tEOF\n+'\n+\n+test_expect_success 'git clone --config= - value' '\n+\ttest_completion \"git clone --config=color.pager=\" <<-\\EOF\n+\tfalse Z\n+\ttrue Z\n+\tEOF\n+'\n+\n test_expect_success 'sourcing the completion script clears cached commands' '\n \t__git_compute_all_commands &&\n \tverbose test -n \"$__git_all_commands\" &&\n-- \n2.23.0.rc2.350.gf4fdc32db7\n\n"},{"id":"380376","messageId":"20190813122652.16468-11-szeder.dev@gmail.com","threadId":"51636","inReplyTo":"20190813122652.16468-1-szeder.dev@gmail.com","subject":"[PATCH 10/11] completion: complete config variables names and values for 'git clone -c'","fromName":"SZEDER Gábor","fromEmail":"szeder.dev@gmail.com","sentAt":"2019-08-13T12:26:51Z","receivedAt":"2019-08-13T12:27:21Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"The previous commits taught the completion script how to complete\nconfiguration section, variable names, and their valus after 'git -c\n<TAB>', and with a bit of foresight encapsulated all that in a\ndedicated helper function.  Use that function to complete the unstuck\nargument of 'git config -c|--config <TAB>', which expect configuration\nvariables and values in the same 'section.name=value' form.\n\nNote that handling the struck argument for 'git clone --config=<TAB>'\nrequires some extra care, so it will be done a separate patch.\n\nSigned-off-by: SZEDER Gábor <szeder.dev@gmail.com>\n---\n contrib/completion/git-completion.bash | 6 ++++++\n 1 file changed, 6 insertions(+)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 6f2bc60707..279f04df87 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -1399,6 +1399,12 @@ _git_clean ()\n \n _git_clone ()\n {\n+\tcase \"$prev\" in\n+\t-c|--config)\n+\t\t__git_complete_config_variable_name_and_value\n+\t\treturn\n+\t\t;;\n+\tesac\n \tcase \"$cur\" in\n \t--*)\n \t\t__gitcomp_builtin clone\n-- \n2.23.0.rc2.350.gf4fdc32db7\n\n"},{"id":"380377","messageId":"20190813122652.16468-10-szeder.dev@gmail.com","threadId":"51636","inReplyTo":"20190813122652.16468-1-szeder.dev@gmail.com","subject":"[PATCH 09/11] completion: complete values of configuration variables after 'git -c var='","fromName":"SZEDER Gábor","fromEmail":"szeder.dev@gmail.com","sentAt":"2019-08-13T12:26:50Z","receivedAt":"2019-08-13T12:27:22Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"'git config' expects a configuration variable's name and value in\nseparate options, so we complete values as they stand on their own on\nthe command line.  'git -c', however, expects them in a single option\njoined by a '=' character, so we should be able to complete values\nwhen they are following 'section.name=' in the same word.\n\nAdd new options to the __git_complete_config_variable_value() function\nto allow callers to specify the current word to be completed and the\nconfiguration variable whose value is to be completed, and use these\nto complete possible values after 'git -c 'section.name=<TAB>'.\n\nSigned-off-by: SZEDER Gábor <szeder.dev@gmail.com>\n---\n contrib/completion/git-completion.bash | 65 ++++++++++++++++----------\n t/t9902-completion.sh                  |  7 +++\n 2 files changed, 48 insertions(+), 24 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 367b1c50f4..6f2bc60707 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -2229,96 +2229,112 @@ __git_compute_config_vars ()\n }\n \n # Completes possible values of various configuration variables.\n+#\n+# Usage: __git_complete_config_variable_value [<option>]...\n+# --varname=<word>: The name of the configuration variable whose value is\n+#                   to be completed.  Defaults to the previous word on the\n+#                   command line.\n+# --cur=<word>: The current value to be completed.  Defaults to the current\n+#               word to be completed.\n __git_complete_config_variable_value ()\n {\n-\tlocal varname\n+\tlocal varname=\"$prev\" cur_=\"$cur\"\n+\n+\twhile test $# != 0; do\n+\t\tcase \"$1\" in\n+\t\t--varname=*)\tvarname=\"${1##--varname=}\" ;;\n+\t\t--cur=*)\tcur_=\"${1##--cur=}\" ;;\n+\t\t*)\t\treturn 1 ;;\n+\t\tesac\n+\t\tshift\n+\tdone\n \n \tif [ \"${BASH_VERSINFO[0]:-0}\" -ge 4 ]; then\n-\t\tvarname=\"${prev,,}\"\n+\t\tvarname=\"${varname,,}\"\n \telse\n-\t\tvarname=\"$(echo \"$prev\" |tr A-Z a-z)\"\n+\t\tvarname=\"$(echo \"$varname\" |tr A-Z a-z)\"\n \tfi\n \n \tcase \"$varname\" in\n \tbranch.*.remote|branch.*.pushremote)\n-\t\t__gitcomp_nl \"$(__git_remotes)\"\n+\t\t__gitcomp_nl \"$(__git_remotes)\" \"\" \"$cur_\"\n \t\treturn\n \t\t;;\n \tbranch.*.merge)\n-\t\t__git_complete_refs\n+\t\t__git_complete_refs --cur=\"$cur_\"\n \t\treturn\n \t\t;;\n \tbranch.*.rebase)\n-\t\t__gitcomp \"false true merges preserve interactive\"\n+\t\t__gitcomp \"false true merges preserve interactive\" \"\" \"$cur_\"\n \t\treturn\n \t\t;;\n \tremote.pushdefault)\n-\t\t__gitcomp_nl \"$(__git_remotes)\"\n+\t\t__gitcomp_nl \"$(__git_remotes)\" \"\" \"$cur_\"\n \t\treturn\n \t\t;;\n \tremote.*.fetch)\n-\t\tlocal remote=\"${prev#remote.}\"\n+\t\tlocal remote=\"${varname#remote.}\"\n \t\tremote=\"${remote%.fetch}\"\n-\t\tif [ -z \"$cur\" ]; then\n+\t\tif [ -z \"$cur_\" ]; then\n \t\t\t__gitcomp_nl \"refs/heads/\" \"\" \"\" \"\"\n \t\t\treturn\n \t\tfi\n-\t\t__gitcomp_nl \"$(__git_refs_remotes \"$remote\")\"\n+\t\t__gitcomp_nl \"$(__git_refs_remotes \"$remote\")\" \"\" \"$cur_\"\n \t\treturn\n \t\t;;\n \tremote.*.push)\n-\t\tlocal remote=\"${prev#remote.}\"\n+\t\tlocal remote=\"${varname#remote.}\"\n \t\tremote=\"${remote%.push}\"\n \t\t__gitcomp_nl \"$(__git for-each-ref \\\n-\t\t\t--format='%(refname):%(refname)' refs/heads)\"\n+\t\t\t--format='%(refname):%(refname)' refs/heads)\" \"\" \"$cur_\"\n \t\treturn\n \t\t;;\n \tpull.twohead|pull.octopus)\n \t\t__git_compute_merge_strategies\n-\t\t__gitcomp \"$__git_merge_strategies\"\n+\t\t__gitcomp \"$__git_merge_strategies\" \"\" \"$cur_\"\n \t\treturn\n \t\t;;\n \tcolor.pager)\n-\t\t__gitcomp \"false true\"\n+\t\t__gitcomp \"false true\" \"\" \"$cur_\"\n \t\treturn\n \t\t;;\n \tcolor.*.*)\n \t\t__gitcomp \"\n \t\t\tnormal black red green yellow blue magenta cyan white\n \t\t\tbold dim ul blink reverse\n-\t\t\t\"\n+\t\t\t\" \"\" \"$cur_\"\n \t\treturn\n \t\t;;\n \tcolor.*)\n-\t\t__gitcomp \"false true always never auto\"\n+\t\t__gitcomp \"false true always never auto\" \"\" \"$cur_\"\n \t\treturn\n \t\t;;\n \tdiff.submodule)\n-\t\t__gitcomp \"$__git_diff_submodule_formats\"\n+\t\t__gitcomp \"$__git_diff_submodule_formats\" \"\" \"$cur_\"\n \t\treturn\n \t\t;;\n \thelp.format)\n-\t\t__gitcomp \"man info web html\"\n+\t\t__gitcomp \"man info web html\" \"\" \"$cur_\"\n \t\treturn\n \t\t;;\n \tlog.date)\n-\t\t__gitcomp \"$__git_log_date_formats\"\n+\t\t__gitcomp \"$__git_log_date_formats\" \"\" \"$cur_\"\n \t\treturn\n \t\t;;\n \tsendemail.aliasfiletype)\n-\t\t__gitcomp \"mutt mailrc pine elm gnus\"\n+\t\t__gitcomp \"mutt mailrc pine elm gnus\" \"\" \"$cur_\"\n \t\treturn\n \t\t;;\n \tsendemail.confirm)\n-\t\t__gitcomp \"$__git_send_email_confirm_options\"\n+\t\t__gitcomp \"$__git_send_email_confirm_options\" \"\" \"$cur_\"\n \t\treturn\n \t\t;;\n \tsendemail.suppresscc)\n-\t\t__gitcomp \"$__git_send_email_suppresscc_options\"\n+\t\t__gitcomp \"$__git_send_email_suppresscc_options\" \"\" \"$cur_\"\n \t\treturn\n \t\t;;\n \tsendemail.transferencoding)\n-\t\t__gitcomp \"7bit 8bit quoted-printable base64\"\n+\t\t__gitcomp \"7bit 8bit quoted-printable base64\" \"\" \"$cur_\"\n \t\treturn\n \t\t;;\n \t*.*)\n@@ -2430,7 +2446,8 @@ __git_complete_config_variable_name_and_value ()\n {\n \tcase \"$cur\" in\n \t*=*)\n-\t\t# in the next patch...\n+\t\t__git_complete_config_variable_value \\\n+\t\t\t--varname=\"${cur%%=*}\" --cur=\"${cur#*=}\"\n \t\t;;\n \t*)\n \t\t__git_complete_config_variable_name --sfx='='\ndiff --git a/t/t9902-completion.sh b/t/t9902-completion.sh\nindex bf60a11fa8..9e90a64830 100755\n--- a/t/t9902-completion.sh\n+++ b/t/t9902-completion.sh\n@@ -1733,6 +1733,13 @@ test_expect_success 'git -c - variable name' '\n \tEOF\n '\n \n+test_expect_success 'git -c - value' '\n+\ttest_completion \"git -c color.pager=\" <<-\\EOF\n+\tfalse Z\n+\ttrue Z\n+\tEOF\n+'\n+\n test_expect_success 'sourcing the completion script clears cached commands' '\n \t__git_compute_all_commands &&\n \tverbose test -n \"$__git_all_commands\" &&\n-- \n2.23.0.rc2.350.gf4fdc32db7\n\n"}]}