* is ORIG_HEAD allowed to point to a non-existing object?
@ 2016-05-10 12:15 Christian Halstrick
2016-05-10 18:14 ` Junio C Hamano
0 siblings, 1 reply; 2+ messages in thread
From: Christian Halstrick @ 2016-05-10 12:15 UTC (permalink / raw)
To: Git
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: is ORIG_HEAD allowed to point to a non-existing object?
2016-05-10 12:15 is ORIG_HEAD allowed to point to a non-existing object? Christian Halstrick
@ 2016-05-10 18:14 ` Junio C Hamano
0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2016-05-10 18:14 UTC (permalink / raw)
To: Christian Halstrick; +Cc: Git
Christian Halstrick <christian.halstrick@gmail•com> writes:
> 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?
Yes.
HEAD is a ref, but other things like MERGE_HEAD, ORIG_HEAD,
FETCH_HEAD are not considered as refs and they are intended to be
temporary. This does mean that they will become invalid if you
prune objects that are only reachable from them, but your "reflog
expire && gc" falls into "if it hurts, don't do it".
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-05-10 18:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-10 12:15 is ORIG_HEAD allowed to point to a non-existing object? Christian Halstrick
2016-05-10 18:14 ` Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox