# Something strange has happened to my git HEADs.

4 messages from 2008-03-15 to 2008-03-15. Participants: Krzysztof Halasa, Junio C Hamano.
Thread: https://gitlist.dev/t/12709

## Krzysztof Halasa, 2008-03-15 17:44

Subject: Something strange has happened to my git HEADs.
Message-ID: <m38x0j51bw.fsf@maximus.localdomain>
URL: https://gitlist.dev/e/m38x0j51bw.fsf%40maximus.localdomain

```
Hi,

Not sure what has happened but it was hardly expected:

1. I have individual bare git repos in ~/scm and ~/scm/linux-2.6 is one
of them (currently):

intrepid:~/scm/linux-2.6$ find -not -type d
./logs/HEAD
./logs/refs/heads/lirc
./logs/refs/heads/viafb
./logs/refs/heads/ixp4xx23
./logs/refs/heads/linux-stable
./logs/refs/heads/wireless
./logs/refs/heads/ixp4xx-hss-chan-old
./logs/refs/heads/alpine
./logs/refs/heads/linux-test
./logs/refs/heads/linux-router-test
./logs/refs/heads/origin
./logs/refs/heads/ixp4xx-upstream
./logs/refs/heads/linux-router (and so on)
./config
./objects/**********
./description
./HEAD
./hooks/pre-rebase
./hooks/applypatch-msg
./hooks/update
./hooks/post-commit
./hooks/commit-msg
./hooks/pre-commit
./hooks/pre-applypatch
./hooks/post-receive
./hooks/post-update
./info/refs

Config file mostly contains:
[diff]
        renames = copies
[core]
        preferSymlinkRefs = true
(plus less relevant things).

intrepid:~/scm/linux-2.6$ cat HEAD 
ref: refs/heads/origin

There used to be a number of refs and heads but now they are all gone:
intrepid:~/scm/linux-2.6$ find refs/
refs/
refs/heads
refs/tags



2. Working dirs using this repo are in /usr/src/linux* and
/usr/src/linux-test is one of them, currently (.git dir):
lrwx 1      30 2007-10-09 00:55 config -> ~/scm/linux-2.6/config
lrwx 1      35 2007-08-24 18:33 description -> ~/scm/linux-2.6/description
-rw- 1     126 2008-02-01 21:39 FETCH_HEAD
lrwx 1      19 2008-03-15 17:52 HEAD -> refs/heads/eelogger
-rw- 1 2220597 2008-03-15 17:56 index
drwx 2    4096 2008-03-15 17:57 info
-rw- 1   21482 2008-03-15 17:57 info/refs
lrwx 1      28 2007-08-24 18:33 logs -> ~/scm/linux-2.6/logs
lrwx 1      31 2007-08-24 18:33 objects -> ~/scm/linux-2.6/objects
-rw- 1      41 2008-03-15 17:56 ORIG_HEAD
-rw- 1   17909 2008-03-15 17:56 packed-refs
lrwx 1      28 2007-08-24 18:33 refs -> ~/scm/linux-2.6/refs


What I did was (copy & paste):
intrepid:/usr/src/linux-test$ git-status 
# On branch eelogger
nothing to commit (working directory clean)

intrepid:/usr/src/linux-test$ git-rebase v2.6.24
First, rewinding head to replay your work on top of it...
Checking out files: 100% (10213/10213), done.
HEAD is now at 4991408... Linux 2.6.24
Applying I2C: Added eelogger driver - EEPROM kernel console logger
Auto packing your repository for optimum performance. You may also
run "git gc" manually. See "git help gc" for more information.
Counting objects: 744096, done.
Compressing objects: 100% (135615/135615), done.
Writing objects: 100% (744096/744096), done.
Total 744096 (delta 613061), reused 738324 (delta 607483)
error: Ref refs/heads/eelogger is at 9465fea31dff47dee3d0e0018d7aa52d16e14c33 but expected e00e34771aac93479c4d939e4e5cceeca64b38f8
fatal: Cannot lock the ref 'refs/heads/eelogger'.
Could not move back to refs/heads/eelogger

Now all references are gone, the objects seem to be packed correctly
into one 230 MB file (there are some individual object files left,
perhaps orphans).

I have been trying to use gitweb while git-rebase was operating but it
wasn't able to find anything.

How could that happened?
I did the same many times and never had anything like that, but perhaps
the symlinks caused that? It never autopacked while rebasing.

/usr/src/linux-test/.git/info/refs seems to contain all the heads and
tags (including the new eeprom head).

e00e34771aac93479c4d939e4e5cceeca64b38f8 is the old eelogger head
9465fea31dff47dee3d0e0018d7aa52d16e14c33 is the new (rebased) head

git-core-1.5.4.1-1.fc8, it's practically up-to-date Fedora 8 x86_64
SMP.
-- 
Krzysztof Halasa

```

## Krzysztof Halasa, 2008-03-15 17:49

Subject: Re: Something strange has happened to my git HEADs.
Message-ID: <m34pb7513f.fsf@maximus.localdomain>
URL: https://gitlist.dev/e/m34pb7513f.fsf%40maximus.localdomain
In-Reply-To: <m38x0j51bw.fsf@maximus.localdomain>

```
Hmm, I didn't know references are now being packed as well.
-- 
Krzysztof Halasa

```

## Junio C Hamano, 2008-03-15 18:32

Subject: Re: Something strange has happened to my git HEADs.
Message-ID: <7vwso3n8i5.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vwso3n8i5.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <m38x0j51bw.fsf@maximus.localdomain>

```
Krzysztof Halasa <khc@pm.waw.pl> writes:

> 2. Working dirs using this repo are in /usr/src/linux* and
> /usr/src/linux-test is one of them, currently (.git dir):
> lrwx 1      30 2007-10-09 00:55 config -> ~/scm/linux-2.6/config
> lrwx 1      35 2007-08-24 18:33 description -> ~/scm/linux-2.6/description
> -rw- 1     126 2008-02-01 21:39 FETCH_HEAD
> lrwx 1      19 2008-03-15 17:52 HEAD -> refs/heads/eelogger
> -rw- 1 2220597 2008-03-15 17:56 index
> drwx 2    4096 2008-03-15 17:57 info
> -rw- 1   21482 2008-03-15 17:57 info/refs
> lrwx 1      28 2007-08-24 18:33 logs -> ~/scm/linux-2.6/logs
> lrwx 1      31 2007-08-24 18:33 objects -> ~/scm/linux-2.6/objects
> -rw- 1      41 2008-03-15 17:56 ORIG_HEAD
> -rw- 1   17909 2008-03-15 17:56 packed-refs
> lrwx 1      28 2007-08-24 18:33 refs -> ~/scm/linux-2.6/refs

This is wrong.  How did you set this up initially?

If you are putting a work tree by symlinking contents of its .git
directory, info and packed-refs are alsy symlinked.  See how
contrib/workdir/git-new-workdir does this.

```

## Krzysztof Halasa, 2008-03-15 18:44

Subject: Re: Something strange has happened to my git HEADs.
Message-ID: <m3ve3n3jzm.fsf@maximus.localdomain>
URL: https://gitlist.dev/e/m3ve3n3jzm.fsf%40maximus.localdomain
In-Reply-To: <7vwso3n8i5.fsf@gitster.siamese.dyndns.org>

```
Junio C Hamano <gitster@pobox.com> writes:

>> lrwx 1      30 2007-10-09 00:55 config -> ~/scm/linux-2.6/config
>> lrwx 1      35 2007-08-24 18:33 description -> ~/scm/linux-2.6/description
>> -rw- 1     126 2008-02-01 21:39 FETCH_HEAD
>> lrwx 1      19 2008-03-15 17:52 HEAD -> refs/heads/eelogger
>> -rw- 1 2220597 2008-03-15 17:56 index
>> drwx 2    4096 2008-03-15 17:57 info
>> -rw- 1   21482 2008-03-15 17:57 info/refs
>> lrwx 1      28 2007-08-24 18:33 logs -> ~/scm/linux-2.6/logs
>> lrwx 1      31 2007-08-24 18:33 objects -> ~/scm/linux-2.6/objects
>> -rw- 1      41 2008-03-15 17:56 ORIG_HEAD
>> -rw- 1   17909 2008-03-15 17:56 packed-refs
>> lrwx 1      28 2007-08-24 18:33 refs -> ~/scm/linux-2.6/refs
>
> This is wrong.  How did you set this up initially?

By hand, I'm using that from the beginning (with some incremental
changes). Are only info and packed-refs missing?

> If you are putting a work tree by symlinking contents of its .git
> directory, info and packed-refs are alsy symlinked.

Info seems to have been dropped somehow or maybe never linked in this
directory, but it's not a problem unless I see it again. I just didn't
know about packing references, linking packed-refs made it work.

How about the error message? Seems serious, though git-rebase did its
work.
-- 
Krzysztof Halasa

```
