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

Re: cloning a tree which has detached branch checked out

From
MTMichael S. Tsirkin <mst@redhat.com>
Date
Feb 7, 2012, 10:41 UTC
Message-ID
<20120207104100.GA24828@redhat.com>
In-Reply-To
<m362fjklb7.fsf@localhost.localdomain>
On Tue, Feb 07, 2012 at 02:08:33AM -0800, Jakub Narebski wrote:
Show 30 quoted lines
> "Michael S. Tsirkin" <mst@redhat.com> writes:
> 
> > I have a tree where I checked out a remote, without
> > creating a local branch, this detaches the HEAD:
> > # git branch
> > * (no branch)
> >   master
> > #git log|head -1
> > commit cec64082f689f949a397cb9b39423dc41545fa0e
> > #git log master..HEAD|head -1
> > commit cec64082f689f949a397cb9b39423dc41545fa0e
> > 
> > 
> > Now if I try to clone it:
> > #git clone -n lab:/home/mst/scm/linux
> > Initialized empty Git repository in /home/mst/scm/linux/.git/
> > remote: Counting objects: 1693446, done.
> > remote: Compressing objects: 100% (277054/277054), done.
> > Receiving objects: 100% (1693446/1693446), 418.16 MiB | 7.63 MiB/s,
> > done.
> > remote: Total 1693446 (delta 1414353), reused 1681280 (delta 1402358)
> > Resolving deltas: 100% (1414353/1414353), done.
> > error: Trying to write ref HEAD with nonexistant object
> > cec64082f689f949a397cb9b39423dc41545fa0e
> > fatal: Cannot update the ref 'HEAD'.
> > 
> > Looks like a bug, doesn't it?
> 
> Which git version?  IIRC there was some bugfix recently in that
> area...

Sorry, forgot to mention that. It's pretty recent: $ git --version git version 1.7.9.111.gf3fb0

> -- 
> Jakub Narebski
Previous: Jakub NarebskiNext: Nguyen Thai Ngoc Duy
Message 3 of 10 in “cloning a tree which has detached branch checked out”
  1. Michael S. TsirkinFeb 7, 2012
  2. Jakub NarebskiFeb 7, 2012
  3. Michael S. TsirkinFeb 7, 2012
  4. Nguyen Thai Ngoc DuyFeb 7, 2012
  5. Michael S. TsirkinFeb 7, 2012
  6. Nguyen Thai Ngoc DuyFeb 7, 2012
  7. Jeff KingFeb 7, 2012
  8. Junio C HamanoFeb 7, 2012
  9. Jeff KingFeb 7, 2012
  10. Michael S. TsirkinFeb 8, 2012

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.