Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] is a detached HEAD a symbolic reference?

20 okt 2010 kl. 09:48 skrev Christian Halstrick:

> Hi,
> I always thought that HEAD is always a "symbolic ref" and Ref.isSymbolic
> should tell me true on HEAD. But that's not true. If we have checked out
> a commit (not a branch) then isSymbolic tells me false. Is that correct?

Yes, that is correct. When the HEAD is detached the commit id is stored
directly in HEAD.

> Loelingers book "Version Control with Git" tells that a symref is
> indirectly points
> to an git object. If HEAD points to a SHA1 and that SHA1 points to an object
> isn't that indirect enough?

In that case HEAD points to a tag, but when detaching HEAD it will point
directly to a commit. HEAD referring to a tag seems strange to me.

> If the answer is "Works as designed. If we have a detached HEAD that HEAD
> is not a symref" then comes the next question: How should we call the node
> in EGit's Repository View where list HEAD. Currently it's called
> "Symbolic References"
> and consequently if we checkout a commit the HEAD references vanishes from this
> view. That's a bug.

HEAD is kind of special to the user. Maybe there should be a special references section for HWEAD and stash.
HEAD would appear in both Special and Symbolic (if not detached). ORIG_HEAD and MERGE_HEAD are also special
refs (usually not symbolic), but rarely as interesting as HEAD.

- robin

Back to the top