devhub-tud / devhub

DevHub is a software system designed to give students a simple practical introduction into modern software development.
15 stars 8 forks source link

Going to the repository root shows wrong branch name in selection menu #441

Open gerarts opened 7 years ago

gerarts commented 7 years ago

Visiting the repository shows the branch that was last pushed to in the menu on the right, but the contents of the master branch. Since these don't match up it makes for some confusion when checking if a push was successful.

pasted_image_at_2017_04_28_01_35_pm

Edit: This happens when going to the repository root (for example by clicking on Commits in the menu on the left)

jwgmeligmeyling commented 7 years ago

We either change master to refs/heads/master in ProjectResource.java#L92 so that its not incorrectly matched to any other branch matching **master in JGitRepositoryFacade.java#L157, or we should replace the endsWith(String) with an equals(String) comparison. The cleanest solution seems to be to prepend refs/heads/ if its not given, and then use an equals comparison instead. I think that's what Git is supposed to do under the hood too. But I am not certain what the side effects would be, as I remember that the branch prefix differs for bare and non-bare repositories. The git-server mostly uses bare-repositories, but not always. @LiamClark What do you think?

jwgmeligmeyling commented 7 years ago

See also the commit https://github.com/devhub-tud/git-server/commit/ac0853872ce3d0f57bfbfa3b8429214665c3322d which kind of proves the point we have been struggling with a related issue before (as it was included in a hotfix release).