From: Felipe Contreras <hidden> Date: 2016-06-15 22:53:35
Hi,
Just a few simpliciations, improvements, and add some missing options.
This series depends on the bash completion tests patch.
Since v2:
* Add 'git --option <TAB>' fix
* Improve --exec-path patch
Felipe Contreras (3):
completion: simplify __gitcomp_1
completion: trivial simplification
completion: add missing general options
Jonathan Nieder (1):
completion: avoid trailing space for --exec-path
SZEDER Gábor (1):
completion: fix completion after 'git --option <TAB>'
contrib/completion/git-completion.bash | 18 +++++++++------
t/t9902-completion.sh | 38 ++++++++++++++++++++++++++++++++
2 files changed, 49 insertions(+), 7 deletions(-)
--
1.7.10.1.g1f19b8.dirty
From: Felipe Contreras <hidden> Date: 2016-06-15 22:53:35
From: Jonathan Nieder <redacted>
--exec-path looks to the completion script like an unambiguous
successful completion, but it is wrong; the user could be trying to
do
git --exec-path; # print name of helper directory
or
git --exec-path=/path/to/alternative/helper/dir <subcommand>
so the most helpful thing to do is to leave out the trailing space and
leave it to the operator to type an equal sign or carriage return
according to the situation.
Cc: Andreas Schwab <redacted>
Reported-by: Felipe Contreras <redacted>
Signed-off-by: Jonathan Nieder <redacted>
[added tests]
Signed-off-by: Felipe Contreras <redacted>
---
contrib/completion/git-completion.bash | 1 +
t/t9902-completion.sh | 7 ++++++-
2 files changed, 7 insertions(+), 1 deletion(-)
From: Felipe Contreras <hidden> Date: 2016-06-15 22:53:35
From: SZEDER Gábor <redacted>
Git's bash completion currently doesn't work when certain git options
are specified, e.g. 'git --no-pager <TAB>' errors out with "error:
invalid key: alias.--no-pager".
The main _git() completion function finds out the git command name by
looping through all the words on the command line and searching for
the first word that is not a known option for the git command.
Unfortunately the list of known git options was not updated in a long
time, and newer options are not skipped but mistaken for a git
command. Such a misrecognized "command" is then passed to
__git_aliased_command(), which in turn passes it to a 'git config'
query, hence the error.
Currently the following options are misrecognized for a git command:
-c --no-pager --exec-path --html-path --man-path --info-path
--no-replace-objects --work-tree= --namespace=
To fix this we could just update the list of options to be skipped,
but the same issue will likely arise, if the git command learns a new
option in the future. Therefore, to make it more future proof against
new options, this patch changes that loop to skip all option-looking
words, i.e. words starting with a dash.
We also have to handle the '-c' option specially, because it takes a
configutation parameter in a separate word, which must be skipped,
too.
Signed-off-by: SZEDER Gábor <redacted>
[added tests]
Signed-off-by: Felipe Contreras <redacted>
---
contrib/completion/git-completion.bash | 3 ++-
t/t9902-completion.sh | 17 +++++++++++++++++
2 files changed, 19 insertions(+), 1 deletion(-)
From: Jonathan Nieder <hidden> Date: 2016-06-15 22:53:35
Felipe Contreras wrote:
Just a few simpliciations, improvements, and add some missing options.
I generally like this. Quick comments:
Felipe Contreras (3):
completion: simplify __gitcomp_1
Thomas and Gábor seem to have this one covered, with some improvements
to it under discussion.
completion: trivial simplification
Improves consistency. The changelog line isn't precise enough to
remind me which change is being mentioned when reading it in the
shortlog, so I guess I'd prefer something like
completion: simplify by using $prev variable
completion: add missing general options
Likewise, a subject line like the following would work better for
me.
completion: --info-path and --no-replace-objects options for git
Hope that helps,
Jonathan
From: Felipe Contreras <hidden> Date: 2016-06-15 22:53:35
On Sun, Apr 15, 2012 at 4:20 PM, Jonathan Nieder [off-list ref] wrote:
Felipe Contreras wrote:
quoted
completion: trivial simplification
Improves consistency. The changelog line isn't precise enough to
remind me which change is being mentioned when reading it in the
shortlog, so I guess I'd prefer something like
completion: simplify by using $prev variable
OK.
quoted
completion: add missing general options
Likewise, a subject line like the following would work better for
me.
completion: --info-path and --no-replace-objects options for git
That's too long, and I think it's less understandable: for git? Of
course it's for git, for what else could it be? :) maybe s/options for
git/general options/, but it's still too long.
I'll leave it like that, anybody else can change it if they wish.
Cheers.
--
Felipe Contreras