git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] completion: support 'git config --local'

From
Jeff King <peff@peff.net>
Date
Feb 12, 2013, 21:11 UTC
Message-ID
<20130212211140.GA29358@sigill.intra.peff.net>
In-Reply-To
<7vzjz9h1w0.fsf@alter.siamese.dyndns.org>
On Tue, Feb 12, 2013 at 09:34:39AM -0800, Junio C Hamano wrote:
Show 11 quoted lines
> 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.

Show 5 quoted lines
> 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
Previous: Junio C HamanoNext: Junio C Hamano
Message 6 of 9 in “git-completion.bash --local”
  1. Dasa PaddockFeb 9, 2013
  2. Jeff KingFeb 11, 2013
  3. completion: recognize "--local" as a config file sourceJeff King, Feb 12, 2013
  4. completion: support 'git config --local'Matthieu Moy, Feb 12, 2013
  5. Junio C HamanoFeb 12, 2013
  6. Jeff KingFeb 12, 2013
  7. Junio C HamanoFeb 12, 2013
  8. Jeff KingFeb 13, 2013
  9. Matthieu MoyFeb 13, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.