-
Notifications
You must be signed in to change notification settings - Fork 28.5k
Comparing changes
Open a pull request
base repository: git/git
base: f76bd8c6b1
head repository: git/git
compare: 5af9d5f6c8
- 11 commits
- 2 files changed
- 1 contributor
Commits on Aug 13, 2019
-
completion: fix a typo in a comment
Signed-off-by: SZEDER Gábor <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 08a1217 - Browse repository at this point
Copy the full SHA 08a1217View commit details -
completion: complete more values of more 'color.*' configuration vari…
…ables Most 'color.*' configuration variables, with the sole exception of 'color.pager', accept the same set of values, but our completion script recognizes only about half of them. We could explicitly add all those missing variables, but let's try to reduce future maintenance burden, and use the catch-all 'color.*' pattern instead, so this list won't get out of sync when a similar new configuration variable accepting the same values is introduced [1]. Furthermore, their documentation explicitly mentions that they all accept the standard boolean values 'false' and 'true' as well, so list these, too, among the possible values. [1] OTOH, there will be a maintenance burden if ever a new 'color.something' is introduced which doesn't accept the same set of values. We'll see which one happens first... Signed-off-by: SZEDER Gábor <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>Configuration menu - View commit details
-
Copy full SHA for 840d7e5 - Browse repository at this point
Copy the full SHA 840d7e5View commit details -
completion: add tests for 'git config' completion
The next patches will change/refactor the way we complete configuration variable names and values, so add a few tests to cover the basics, namely the completion of matching configuration sections, full variable names, and their values. Note that the test checking the completion of configuration sections is currently failing, though it's not a sign of an actual bug. If a section contains multiple variables, then that section is currently repeated as many times as the number of variables in there. This is not a correctness issue in practice, because Bash's completion facilities remove all repetitions anyway. Consequently, we could list all those repeated sections in the expected output of this test as well, but then it would have to be updated whenever a new configuration variable is added to those sections. Instead, list each matching configuration section only once, mark the test as failing for now, and the next patch will update the completion script to avoid those repetitions. Signed-off-by: SZEDER Gábor <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 7a09a8f - Browse repository at this point
Copy the full SHA 7a09a8fView commit details -
completion: deduplicate configuration sections
The number of configuration variables listed by the completion script grew quite when we started to auto-generate it from the documentation [1], so we now complete them in two steps: first we list only the section names, then the rest [2]. To get the section names we simply strip everything following the first dot in each variable name, resulting in a lot of repeated section names, because most sections contain more than one configuration variable. This is not a correctness issue in practice, because Bash's completion facilities remove all repetitions anyway, but these repetitions make testing a bit harder. Replace the small 'sed' script removing subsections and variable names with an 'awk' script that does the same, and in addition removes any repeated configuration sections as well (by first creating and filling an associative array indexed by all encountered configuration sections, and then iterating over this array and printing the indices, i.e. the unique section names). This change makes the failing 'git config - section' test in 't9902-completion.sh' pass. Note that this changes the order of section names in the output, and makes it downright undeterministic, but this is not an issue, because Bash sorts them before presenting them to the user, and our completion tests sort them as well before comparing with the expected output. Yeah, it would be simpler and shorter to just append '| sort -u' to that command, but that would incur the overhead of one more external process and pipeline stage every time a user completes configuration sections. [1] e17ca92 (completion: drop the hard coded list of config vars, 2018-05-26) [2] f22f682 (completion: complete general config vars in two steps, 2018-05-27) Signed-off-by: SZEDER Gábor <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for d943887 - Browse repository at this point
Copy the full SHA d943887View commit details -
completion: use 'sort -u' to deduplicate config variable names
The completion script runs the classic '| sort | uniq' pipeline to deduplicate the output of 'git help --config-for-completion'. 'sort -u' does the same, but uses one less external process and pipeline stage. Not a bit win, as it's only run once as the list of supported configuration variables is initialized, but at least it sets a better example for others to follow. Signed-off-by: SZEDER Gábor <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 2675ea1 - Browse repository at this point
Copy the full SHA 2675ea1View commit details -
completion: simplify inner 'case' pattern in __gitcomp()
The second '*' in the '--*=*' pattern of the inner 'case' statement of the __gitcomp() helper function never matches anything, so let's use '--*=' instead. The purpose of that inner case statement is to decide when to append a trailing space to the listed options and when not. When an option requires a stuck argument, i.e. '--option=', then the trailing space should not be added, so the user can continue typing the required argument right away. That '--*=*' pattern is supposed to match these options, but for this purpose that second '*' is unnecessary, a '--*=' pattern works just as well. That second '*' would only make a difference in case of a possible completion word like '--option=value', but our completion script never passes such a word to __gitcomp(), because the '--option=' and its 'value' must be completed separately. Signed-off-by: SZEDER Gábor <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for d9ee1e0 - Browse repository at this point
Copy the full SHA d9ee1e0View commit details -
completion: split _git_config()
_git_config() contains two enormous case statements, one to complete configuration sections and variable names, and the other to complete their values. Split these out into two separate helper functions, so in the next patches we can use them to implement completion for 'git -c <TAB>'. Signed-off-by: SZEDER Gábor <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 42d0efe - Browse repository at this point
Copy the full SHA 42d0efeView commit details -
completion: complete configuration sections and variable names for 'g…
…it -c' 'git config' expects a configuration variable's name and value in separate arguments, so we let the __gitcomp() helper append a space character to each variable name by default, like we do for most other things (--options, refs, paths, etc.). 'git -c', however, expects them in a single option joined by a '=' character, i.e. 'section.name=value', so we should append a '=' character to each fully completed variable name, but no space, so the user can continue typing the value right away. Add an option to the __git_complete_config_variable_name() function to allow callers to specify an alternate suffix to add, and use it to append that '=' character to configuration variables. Update the __gitcomp() helper function to not append a trailing space to any completion words ending with a '=', not just to those option with a stuck argument. Signed-off-by: SZEDER Gábor <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for e1e0008 - Browse repository at this point
Copy the full SHA e1e0008View commit details -
completion: complete values of configuration variables after 'git -c …
…var=' 'git config' expects a configuration variable's name and value in separate options, so we complete values as they stand on their own on the command line. 'git -c', however, expects them in a single option joined by a '=' character, so we should be able to complete values when they are following 'section.name=' in the same word. Add new options to the __git_complete_config_variable_value() function to allow callers to specify the current word to be completed and the configuration variable whose value is to be completed, and use these to complete possible values after 'git -c 'section.name=<TAB>'. Signed-off-by: SZEDER Gábor <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for dd33472 - Browse repository at this point
Copy the full SHA dd33472View commit details -
completion: complete config variables names and values for 'git clone…
… -c' The previous commits taught the completion script how to complete configuration section, variable names, and their valus after 'git -c <TAB>', and with a bit of foresight encapsulated all that in a dedicated helper function. Use that function to complete the unstuck argument of 'git config -c|--config <TAB>', which expect configuration variables and values in the same 'section.name=value' form. Note that handling the struck argument for 'git clone --config=<TAB>' requires some extra care, so it will be done a separate patch. Signed-off-by: SZEDER Gábor <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 88cd790 - Browse repository at this point
Copy the full SHA 88cd790View commit details -
completion: complete config variables and values for 'git clone --con…
…fig=' Completing configuration sections and variable names for the stuck argument of 'git clone --config=<TAB>' requires a bit of extra care compared to doing the same for the unstuck argument of 'git clone --config <TAB>', because we have to deal with that '--config=' being part of the current word to be completed. Add an option to the __git_complete_config_variable_name_and_value() and in turn to the __git_complete_config_variable_name() helper functions to specify the current section/variable name to be completed, so they can be used even when completing the stuck argument of '--config='. __git_complete_config_variable_value() already has such an option, and thus no further changes were necessary to complete possible values after 'git clone --config=section.name=<TAB>'. Signed-off-by: SZEDER Gábor <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 5af9d5f - Browse repository at this point
Copy the full SHA 5af9d5fView commit details
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff f76bd8c6b1...5af9d5f6c8