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

Re: [PATCH] completion: optionally disable checkout DWIM

From
Jeff King <peff@peff.net>
Date
Apr 21, 2017, 05:03 UTC
Message-ID
<20170421050330.ntnbri6qybi5i3pe@sigill.intra.peff.net>
In-Reply-To
<xmqqzifa4amr.fsf@gitster.mtv.corp.google.com>
On Thu, Apr 20, 2017 at 10:01:32PM -0700, Junio C Hamano wrote:
Show 17 quoted lines
> Jeff King <peff@peff.net> writes:
> 
> > When we complete branch names for "git checkout", we also
> > complete remote branch names that could trigger the DWIM
> > behavior. Depending on your workflow and project, this can
> > be either convenient or annoying.
> > ...
> > This is flexible enough for me, but it's possible somebody would want
> > this on a per-repo basis. I don't know that we want to read from `git
> > config`, though, because it's relatively expensive to do so. People who
> > want per-repo settings are probably better off with a hook that triggers
> > when they "cd" around, and sets up their preferences.
> 
> Sounds OK.  I am kind of surprised that --no-guess is the only way
> to turn off this dwimming (not in the completion side, but there
> does not seem to be a way to tell "git checkout" that you do not
> need that create-missing-branch-out-of-remote-tracking).

Yeah, I didn't even know about --no-guess until reading the completion script (it's intentionally undocumented). I did consider teaching checkout a config option for "do not DWIM". But I think it's really the completion that bugs me. The DWIM is easy to avoid triggering if you just don't feed it the remote branch names. It's the completion that routinely leads me to doing that. :)

-Peff
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 10 in “completion: optionally disable checkout DWIM”
  1. completion: optionally disable checkout DWIMJeff King, Apr 20, 2017
  2. Junio C HamanoApr 21, 2017
  3. Jeff KingApr 21, 2017
  4. Junio C HamanoApr 21, 2017
  5. SZEDER GáborApr 21, 2017
  6. Jeff KingApr 21, 2017
  7. SZEDER GáborApr 22, 2017
  8. Jacob KellerApr 21, 2017
  9. completion: optionally disable checkout DWIMJeff King, Apr 21, 2017
  10. Brandon WilliamsApr 24, 2017

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.