I think this line should include --local:
https://github.com/git/git/blob/next/contrib/completion/git-completion.bash#L1782
"--global|--system|--file=*)"This would help for:
git config -l --localThanks, Dasa Paddock
I think this line should include --local:
https://github.com/git/git/blob/next/contrib/completion/git-completion.bash#L1782
"--global|--system|--file=*)"This would help for:
git config -l --localThanks, Dasa Paddock
Re: git-completion.bash --local
On Sat, Feb 09, 2013 at 06:37:28PM +0000, Dasa Paddock wrote:
> I think this line should include --local: > > https://github.com/git/git/blob/next/contrib/completion/git-completion.bash#L1782 > "--global|--system|--file=*)"
Yeah, I think that makes sense.
Care to prepare a patch?
-Peff
[PATCH] completion: recognize "--local" as a config file source
When we are trying to show the list of config variables in a file, we recognize "--system", "--global", and "--file" as specifying a particular file. This list misses "--local", which performs a similar function.
Without this patch, completing:
git config --get --local
shows items from all config files, not just the local one.
Noticed-by: Dasa Paddock <dpaddock@esri.com> Signed-off-by: Jeff King <peff@peff.net> --- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index c8452fb..0b7b659 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1779,7 +1779,7 @@ __git_config_get_set_variables () while [ $c -gt 1 ]; do word="${words[c]}" case "$word" in - --global|--system|--file=*) + --global|--system|--local|--file=*) config_file="$word" break ;;
-- 1.8.1.2.11.g1a2f572
[PATCH] completion: support 'git config --local'
This needs to be done in two places: __git_config_get_set_variables to allow clever completion of "git config --local --get foo<tab>", and _git_config to allow "git config --loc<tab>" to complete to --local.
While we're there, change the order of options in the code to match git-config.txt.
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> ---
> I think this line should include --local: > > https://github.com/git/git/blob/next/contrib/completion/git-completion.bash#L1782 > "--global|--system|--file=*)" > > This would help for: > git config -l --local
Yes, but not only ;-)
contrib/completion/git-completion.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 5770b6f..2e1ad67 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1570,7 +1570,7 @@ __git_config_get_set_variables () while [ $c -gt 1 ]; do word="${words[c]}" case "$word" in - --global|--system|--file=*) + --system|--global|--local|--file=*) config_file="$word" break ;; @@ -1676,7 +1676,7 @@ _git_config () case "$cur" in --*) __gitcomp " - --global --system --file= + --system --global --local --file= --list --replace-all --get --get-all --get-regexp --add --unset --unset-all
-- 1.8.1.2.548.g956380a.dirty
Re: [PATCH] completion: support 'git config --local'
Matthieu Moy <Matthieu.Moy@imag.fr> writes:
> This needs to be done in two places: __git_config_get_set_variables to > allow clever completion of "git config --local --get foo<tab>", and > _git_config to allow "git config --loc<tab>" to complete to --local. > > While we're there, change the order of options in the code to match > git-config.txt. > > Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> > --- >> I think this line should include --local: >> >> https://github.com/git/git/blob/next/contrib/completion/git-completion.bash#L1782 >> "--global|--system|--file=*)" >> >> This would help for: >> git config -l --local > > Yes, but not only ;-)
I see the second hunk is new. Comments?
How would this interract with the writing side of "git config"? "git config --local foo.bar value" and "git config foo.bar value" are the same, no?
Is it "yes they are the same but it does not hurt?"
> contrib/completion/git-completion.bash | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index 5770b6f..2e1ad67 100644
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -1570,7 +1570,7 @@ __git_config_get_set_variables ()
> while [ $c -gt 1 ]; do
> word="${words[c]}"
> case "$word" in
> - --global|--system|--file=*)
> + --system|--global|--local|--file=*)
> config_file="$word"
> break
> ;;
> @@ -1676,7 +1676,7 @@ _git_config ()
> case "$cur" in
> --*)
> __gitcomp "
> - --global --system --file=
> + --system --global --local --file=
> --list --replace-all
> --get --get-all --get-regexp
> --add --unset --unset-allRe: [PATCH] completion: support 'git config --local'
On Tue, Feb 12, 2013 at 09:34:39AM -0800, Junio C Hamano wrote:
> I see the second hunk is new. Comments? > [...] > > @@ -1676,7 +1676,7 @@ _git_config () > > case "$cur" in > > --*) > > __gitcomp " > > - --global --system --file= > > + --system --global --local --file= > > --list --replace-all > > --get --get-all --get-regexp > > --add --unset --unset-all
It makes sense to me. It just means that "--local" itself gets completed (while the other hunk is about using the presence of "--local" impacting other completion). It's an orthogonal issue, but I don't mind them in the same patch.
> How would this interract with the writing side of "git config"? > "git config --local foo.bar value" and "git config foo.bar value" > are the same, no? > > Is it "yes they are the same but it does not hurt?"
It doesn't affect writing at all. The change is in __git_config_get_set_variables, which is used only here:
--get|--get-all|--unset|--unset-all)
__gitcomp_nl "$(__git_config_get_set_variables)"So it is purely about completing existing variables, and it's right to limit itself to a particular file if we know that is what has been given.
I'm not sure I understand the original poster's point about "git config -l --local". "-l" does not take a limiter, does it?
-Peff
Re: [PATCH] completion: support 'git config --local'
Jeff King <peff@peff.net> writes:
> I'm not sure I understand the original poster's point about "git config > -l --local". "-l" does not take a limiter, does it?
"git config -l core.\*" will just die without limiting the output to everything under core. hierarchy, so you are right---the combination does not make any sense. You have to say
git config -l | grep ^core\\.
or something like that.
Completing "git config -l --lo<TAB>" still may help, though.
Re: [PATCH] completion: support 'git config --local'
On Tue, Feb 12, 2013 at 02:13:05PM -0800, Junio C Hamano wrote:
> Jeff King <peff@peff.net> writes: > > > I'm not sure I understand the original poster's point about "git config > > -l --local". "-l" does not take a limiter, does it? > > "git config -l core.\*" will just die without limiting the output to > everything under core. hierarchy, so you are right---the combination > does not make any sense. You have to say > > git config -l | grep ^core\\. > > or something like that. > > Completing "git config -l --lo<TAB>" still may help, though.
Ah, I think I see Dasa's original point now. He was interested in fixing "--lo<TAB>" to complete "--local". But the line he pointed to in his original message is not the right place for that; it is the site of an unrelated spot which should _also_ be fixed to use "--local", but for a different reason (restricting the variables suggested for "--local --get <TAB>" properly).
So yeah. Matthieu's patch is the right thing to do, as it covers both (mine fixed only half of it).
-Peff
Re: [PATCH] completion: support 'git config --local'
Jeff King <peff@peff.net> writes:
> So yeah. Matthieu's patch is the right thing to do, as it covers both
Thanks,
> (mine fixed only half of it).
(Sorry, I had missed yours)
-- Matthieu Moy http://www-verimag.imag.fr/~moy/