is ORIG_HEAD allowed to point to a non-existing object?
- From
Christian Halstrick <christian.halstrick@gmail.com>
- Date
- May 10, 2016, 12:15 UTC
- Message-ID
- <CAENte7jNxM7J9bWUnrOkLQJZ=8JEtYzw9-uxVkq-CpvGyk9UUw@mail.gmail.com>
If I do a "git-rebase -i ..." followed by "git reflog expire ..." and "git gc ..." then I can end up with a repo which has a ref ORIG_HEAD which points to a non-existing object.
- Is this intended? - What's the reason to keep a ref which points to a non-existing object? - Are there any other refs which are allowed to point to non-existing objects?
Here is how I reproduced the problem:
> git init
Initialized empty Git repository in /tmp/yy/.git/
> touch a > git add a > git commit -m addA
[master (root-commit) ff82f68] addA 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 a
> echo 2 >a > git commit -a -m modA
[master f9ae5a7] modA 1 file changed, 1 insertion(+)
> echo 3 >a > git commit -a -m 'fixup! modA'
[master 271012b] fixup! modA 1 file changed, 1 insertion(+), 1 deletion(-)
> git rebase -i --autosquash HEAD~~
[detached HEAD 3eb17d4] modA 1 file changed, 1 insertion(+) Successfully rebased and updated refs/heads/master.
> git rev-parse --short ORIG_HEAD
271012b
> git reflog expire --expire=now --all > git rev-parse 271012b
271012be467fcbd62a875b7187c0e9871f62ac0d
> git gc --prune=now
Counting objects: 6, done. Delta compression using up to 2 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (6/6), done. Total 6 (delta 1), reused 0 (delta 0)
> git rev-parse 271012b
271012b fatal: ambiguous argument '271012b': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git <command> [<revision>...] -- [<file>...]'
> git rev-parse --short ORIG_HEAD
271012b
Ciao Chris