Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 324412 - [repoView] Render branch information properly in case of detached head
Summary: [repoView] Render branch information properly in case of detached head
Status: CLOSED FIXED
Alias: None
Product: JGit
Classification: Technology
Component: JGit (show other bugs)
Version: 0.9.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-03 09:19 EDT by Mathias Kinzler CLA
Modified: 2013-08-12 09:25 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.