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

Inconsistent behavior of the path disambiguator

From
Dun Peal <dunpealer@gmail.com>
Date
Oct 29, 2010, 18:11 UTC
Message-ID
<AANLkTinM863uZfRxy_1BW1fnfEPsPo8A2m86=Wxh7XGd@mail.gmail.com>
Hi.

When I clone a remote that has a branch `foo`, then `git checkout foo --`, the path disamgiuator makes the operation fail. `git checkout foo` without the disambiguator works. Following that, when branch `foo` already exists, `git checkout foo --` works even with the disambiguator that caused it to fail previously.

Here's a log demonstrating a full reproduction of the bug with git 1.7.2 on Linux:

=== LOG START ===
$ mkdir origin && cd origin && git init && echo 1 >> test.txt && git
add test.txt && git commit -am "First." && git branch foo
Initialized empty Git repository in /home/afine/lab/gitexp/origin/origin/.git/
[master (root-commit) 6042525] First.
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 test.txt
$ cd .. && git clone origin local && cd local
Cloning into local...
done.
$ git checkout foo --
fatal: invalid reference: foo
$ git checkout foo
Branch foo set up to track remote branch foo from origin.
Switched to a new branch 'foo'
$ git checkout master
Switched to branch 'master'
$ git checkout foo --
Switched to branch 'foo'
=== LOG END ===
This looks like a bug.
Thanks, D
Next: Junio C Hamano
Message 1 of 10 in “Inconsistent behavior of the path disambiguator”
  1. Dun PealOct 29, 2010
  2. Junio C HamanoOct 29, 2010
  3. Dun PealOct 29, 2010
  4. Re* Inconsistent behavior of the path disambiguatorJunio C Hamano, Oct 29, 2010
  5. Jonathan NiederOct 29, 2010
  6. Junio C HamanoOct 29, 2010
  7. checkout: apply Dscho's dwim even with "--" presentJonathan Nieder, Oct 29, 2010
  8. Jonathan NiederOct 29, 2010
  9. Jonathan NiederOct 30, 2010
  10. Junio C HamanoOct 31, 2010

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.