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

Re: [PATCH] checkout: disambiguate dwim tracking branches and local files

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 12, 2018, 19:44 UTC
Message-ID
<xmqq36s613p8.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<CACsJy8DZy2hozNypxizF=LmJn8gw9z5HGhV0paiMuM9+gxYVvg@mail.gmail.com>
Duy Nguyen <pclouds@gmail.com> writes:
Show 5 quoted lines
> Is it that different between an exact path name and a pathspec?
> Suppose it is a pathspec (with wildcards) that matches some paths, and
> we happen to have the remote branch origin/<that-pathspec>, then it is
> still ambiguous whether we should go create branch
> "<that-pathspec>" or go check out the paths matched by the pathspec.

: A huge difference between these two

	$ echo Hello >'n??t' && git add 'n??t'
	$ git branch 'n??t'

is that the former is taken and the latter is rejected, even though neither of them is particularly a sane or a likely thing.

Isn't that a good enough reason why
	$ git checkout 'n??t'

cannot mean checking 'n??t' branch out, be it either an existing local one or auto-vivified one out of a remote-tracking branch?

> I think you see 'n??t' as a pathspec, but I'm thinking about a user
> who sees 'n??t' as a branch name, not pathspec and he would have a
> different expectation.

See above for the reason why I think there is no room for different expectations to come in the picture in this case.

Previous: Duy NguyenNext: Nguyễn Thái Ngọc Duy
Message 4 of 6 in “checkout: disambiguate dwim tracking branches and local files”
  1. checkout: disambiguate dwim tracking branches and local filesNguyễn Thái Ngọc Duy, Nov 10, 2018
  2. Junio C HamanoNov 12, 2018
  3. Duy NguyenNov 12, 2018
  4. Junio C HamanoNov 12, 2018
  5. 0/1 disambiguate dwim tracking branches and local filesNguyễn Thái Ngọc Duy, Nov 13, 2018
  6. 1/1 checkout: disambiguate dwim tracking branches and local filesNguyễn Thái Ngọc Duy, Nov 13, 2018

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.