Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 324412

Summary: [repoView] Render branch information properly in case of detached head
Product: [Technology] JGit Reporter: Mathias Kinzler <mathias.kinzler>
Component: JGitAssignee: Project Inbox <jgit.core-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: caniszczyk, robin, stefan.lay
Version: 0.9.0   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Mathias Kinzler CLA 2010-09-03 09:19:22 EDT
If HEAD is detached, the corresponding Repository node is rendered in the form

<repo> - <repo path> [293bf13355d4d552f514386ac3690604930162f5]

(simply showing the commit SHA-1).

Instead, it should be rendered in the same way as the label decorator for the project:

<repo> - <repo path> [293bf13... (refs/tags/v0.8.4)]

by doing a "best guess" about which remote tracking branch or tag points to that commit.
The logic for this can be found in RepositoryUtil.mapCommitToRef(). I wonder whether we need to rethink the caching logic of this, though...
We should also make sure to have the "shorten SHA-1" logic in a central place so that we can replace it with JGits logic eventually instead of the hard-coded length of 8.
Comment 1 Chris Aniszczyk CLA 2010-09-03 12:14:04 EDT
Ideally the logic should be in JGit imho
Comment 2 Stefan Lay CLA 2010-10-01 05:08:21 EDT
Please check if the logic to map a commit to refs could be moved to JGit.
Comment 3 Robin Stocker CLA 2013-08-12 09:25:40 EDT
The title no longer applies, it is now shown correctly in the repo view.

The logic is still in EGit though. I don't know if it could be easily moved to JGit, because it uses a cache for some things (but not when using the reflog, strangely).

Let's close this until someone wants to work on this.