Skip to contentSkip to conversation

builtin-remote bug: Stale tracking branch after "git clone"

DISCUSSION Teemu Likonen 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

Hi

I have found a recently added bug. I'm using git version 1.5.4.4.537.gb75aa ('master' branch). I can't describe it technically so I just type instructions how to reproduce it:

1) Clone some git repository. I think any repo will do.

2) Type "git remote show origin" in that cloned repo. You'll see something like this:

* remote origin
URL: [...]
Remote branch merged with 'git pull' while on branch master
master
Stale tracking branch (use 'git remote prune')
HEAD
Tracked remote branch
master

$ find .git/refs/remotes
.git/refs/remotes/
.git/refs/remotes/origin
.git/refs/remotes/origin/HEAD
.git/refs/remotes/origin/master

3) As git asked, type "git remote prune origin".

4) Do "git remote show origin" again and it will display this:

* remote origin
URL: [...]
Remote branch merged with 'git pull' while on branch master
master
New remote branch (next fetch will store in remotes/origin)
master [Hmm, interesting]

Seems like .git/refs/remotes/origin/master was deleted:

$ find .git/refs/remotes/
.git/refs/remotes/
.git/refs/remotes/origin
.git/refs/remotes/origin/HEAD

5) Now fetch that "new" remote branch again with "git fetch" and you'll see this:

error: refs/remotes/origin/HEAD points nowhere!
From [...]
* [new branch] master -> origin/master

6) Now we're back in the beginning. See item 2.