cloning a tree which has detached branch checked out
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?
Signature · 1 line
MST
Quoted 24 lines · Michael S. Tsirkin
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 cec64082f689f949a397cb9b39423dc41545fa0eNow 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 objectcec64082f689f949a397cb9b39423dc41545fa0e
fatal: Cannot update the ref 'HEAD'.
Quoted 1 line
Looks like a bug, doesn't it?
Which git version? IIRC there was some bugfix recently in that area...
Signature · 1 line
Jakub Narebski
Quoted 26 lines · Jakub Narebski
Quoted 24 lines · Michael S. Tsirkin
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 cec64082f689f949a397cb9b39423dc41545fa0eNow 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 objectcec64082f689f949a397cb9b39423dc41545fa0e
fatal: Cannot update the ref 'HEAD'.
Quoted 4 lines
Quoted 1 line
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
Quoted 2 lines
Signature · 1 line
Jakub Narebski
Quoted 6 lines · Michael S. Tsirkin
Quoted 6 lines
Quoted 6 lines
#git clone -n lab:/home/mst/scm/linux
....
error: Trying to write ref HEAD with nonexistant objectcec64082f689f949a397cb9b39423dc41545fa0e
fatal: Cannot update the ref 'HEAD'.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
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
The series that Jakub mentioned is probably nd/clone-detached 5ce2b97, which is already included in your tree. Does 1.7.9 work?
I tried but it was ok for me. I think ref processing at local probably goes wrong and does not request commit from HEAD. If the repo is not confidential, you can zip it and send me.
Signature · 1 line
Duy
Quoted 12 lines · Nguyen Thai Ngoc Duy
Quoted 11 lines · Michael S. Tsirkin
Quoted 10 lines
Quoted 7 lines
#git clone -n lab:/home/mst/scm/linux
....
error: Trying to write ref HEAD with nonexistant objectcec64082f689f949a397cb9b39423dc41545fa0e
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...
Quoted 6 lines
Quoted 3 lines
Sorry, forgot to mention that. It's pretty recent:
$ git --version git version 1.7.9.111.gf3fb0The series that Jakub mentioned is probably nd/clone-detached 5ce2b97, which is already included in your tree. Does 1.7.9 work?
I'll try that.
Quoted 3 lines
I tried but it was ok for me. I think ref processing at local probably goes wrong and does not request commit from HEAD. If the repo is not confidential, you can zip it and send me.
Can't unfortunately :(
Would some verbose logs help?
Quoted 2 lines
Signature · 1 line
Duy
Quoted 6 lines · Michael S. Tsirkin
Quoted 3 lines
I tried but it was ok for me. I think ref processing at local probably goes wrong and does not request commit from HEAD. If the repo is not confidential, you can zip it and send me.
Can't unfortunately :(
Would some verbose logs help?
You can try cloning with GIT_TRACE_PACKET=1. bisect should also help.
Signature · 1 line
Duy
Quoted 16 lines · Nguyen Thai Ngoc Duy
Quoted 6 lines · Michael S. Tsirkin
Quoted 6 lines
Quoted 6 lines
#git clone -n lab:/home/mst/scm/linux
....
error: Trying to write ref HEAD with nonexistant objectcec64082f689f949a397cb9b39423dc41545fa0e
fatal: Cannot update the ref 'HEAD'.Quoted 8 lines
Quoted 4 lines
Quoted 1 line
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
Quoted 6 lines
The series that Jakub mentioned is probably nd/clone-detached 5ce2b97, which is already included in your tree. Does 1.7.9 work?
I tried but it was ok for me. I think ref processing at local probably goes wrong and does not request commit from HEAD. If the repo is not confidential, you can zip it and send me.
This particular bug should have been fixed before that, even, with my c1921c1 (clone: always fetch remote HEAD, 2011-06-07). And it is tested explicitly in t5707, so your series does not regress at least a simple case. So I think your guess about a subtle error in the local ref processing is a reasonable one.
-Peff
Quoted 9 lines · Jeff King
Quoted 7 lines · Nguyen Thai Ngoc Duy
Quoted 6 lines · Michael S. Tsirkin
Quoted 6 lines
Quoted 6 lines
#git clone -n lab:/home/mst/scm/linux
....
error: Trying to write ref HEAD with nonexistant objectcec64082f689f949a397cb9b39423dc41545fa0e
fatal: Cannot update the ref 'HEAD'.
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Looks like a bug, doesn't it?
...
This particular bug should have been fixed before that, even, with my c1921c1 (clone: always fetch remote HEAD, 2011-06-07). And it is tested explicitly in t5707,...
That was my thought when I first saw it. The failure case was that HEAD was pointing at something no ref reaches, and clone was only grabbing the tips of branches, which failed to transfer the history leading to HEAD.
Quoted 2 lines
... So I think your guess about a subtle error in the local ref processing is a reasonable one.
What is funny is "error: Trying to write ref HEAD with nonexistant object". "git grep -e nonexistant f3fb0" does not register any hit.
Could it be that mysterious "lab:" protocol handler that is misbehaving?
Quoted 6 lines · Junio C Hamano
Quoted 3 lines
This particular bug should have been fixed before that, even, with my c1921c1 (clone: always fetch remote HEAD, 2011-06-07). And it is tested explicitly in t5707,...
[...]
What is funny is "error: Trying to write ref HEAD with nonexistant object". "git grep -e nonexistant f3fb0" does not register any hit.
That misspelling of "nonexistent" was fixed by 7be8b3b (Fix typo:existant->existent, 2011-06-16), around the same time as my clone patch. Which really makes me wonder if the OP is accidentally running an old version of git during the tests.
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines · Michael S. Tsirkin
Quoted 1 line
Quoted 1 line
Quoted 1 line
#git clone -n lab:/home/mst/scm/linux
[...]
Could it be that mysterious "lab:" protocol handler that is misbehaving?
I think you are misreading. It would be "lab::" in that case, no? The command above should do ssh transport to the machine "lab".
-Peff
Quoted 5 lines · Jeff King
Quoted 3 lines · Junio C Hamano
Quoted 3 lines
This particular bug should have been fixed before that, even, with my c1921c1 (clone: always fetch remote HEAD, 2011-06-07). And it is tested explicitly in t5707,...
Quoted 8 lines
Quoted 3 lines
[...]
What is funny is "error: Trying to write ref HEAD with nonexistant object". "git grep -e nonexistant f3fb0" does not register any hit.That misspelling of "nonexistent" was fixed by 7be8b3b (Fix typo:
existant->existent, 2011-06-16), around the same time as my clone patch. Which really makes me wonder if the OP is accidentally running an old version of git during the tests.
Double checked and you are right: the box actually runs git 1.7.1. Rechecked with 1.7.9.GIT and it behaves correctly.
My mistake, sorry about the noise.
Signature · 1 line
MST