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

Re: git-checkout changes the index but not the checked out files?

From
Martin Langhoff <martin.langhoff@gmail.com>
Date
Apr 23, 2007, 00:17 UTC
Message-ID
<46a038f90704221717i8e5c1bkff066dcbdb0a0523@mail.gmail.com>
In-Reply-To
<7virbokmx1.fsf@assigned-by-dhcp.cox.net>
On 4/23/07, Junio C Hamano <junkio@cox.net> wrote:
> Shouldn't happen.  Details?
Hmnmm. Not sure really what to look for ;-)

If I try it on my git checkout (checkout origin/pu and then checkout master) nothing strange happens. But if I do it on my project, (fetchable from http://git.catalyst.net.nz/moodle-r2.git ) between a "local" mdl18-local and origin/MOODLE_18_STABLE, it all goes weird.

Just re-ran the process with bash -x, and it switches to a detached head when going to origin/MOODLE_18_STABLE (as expected). And when switching back, it all looks _almost_ reasonable except that there's a call to git-read-tree with -m and 2 sha1s. It is trying to merge mdl18-local and mdl18-topnz apparently.

In fact:
 - I am on mdl18-local
 - git-status is clean
 - git checkout mdl18-local reports "Already on branch "mdl18-local"
but it does a merge anyway
The problem seems to be that the SHA1 returned here is bogus:
   $ git-rev-parse --verify 'mdl18-local^0'
   warning: refname 'mdl18-local' is ambiguous.
   a26c09be05a08e5f911ef84b5f8010ba155ea77d
If I disambiguate it one way or the other, I get correct results
   $ git-rev-parse --verify 'refs/heads/mdl18-local^0'
   634dcf72a31d0c75a98c1d69dd4763def7bcf2d5
   $ git-rev-parse --verify 'remotes/origin/mdl18-local^0'
   6e6ae22a2960d3ac321acd1cdfa09f23068f33b4

but the ambiguous "git-rev-parse --verify 'mdl18-local^0'" returns the SHA1 for a head called 'mdl18-topnz' that I am not asking for. Why?

cheers,
m
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 8 in “git-checkout changes the index but not the checked out files?”
  1. Martin LanghoffApr 22, 2007
  2. Junio C HamanoApr 22, 2007
  3. Martin LanghoffApr 23, 2007
  4. Junio C HamanoApr 23, 2007
  5. Martin LanghoffApr 23, 2007
  6. Linus TorvaldsApr 23, 2007
  7. Martin LanghoffApr 23, 2007
  8. Uwe Kleine-KönigApr 23, 2007

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.