-
Type: Bug
-
Status: Resolved
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 61
-
Fix Version/s: 66
-
Component/s: Versioning & Branch management
-
Sprint:NOS 9.3.1, NOS 9.3.2, NOS 9.3.3
-
Story Points:3
When the current branch of a user is not found (i.e it has been removed directly in gitlab), an alert message pops up saying "Error: The branch "XXX" was not found for the project "project1-spartasystems". Falling back to default branch." But when clicking on OK, nothing happens and the message pops up again and again for ever...
Another problem is found during the implementation: the alert message pop up twice before falling back to the master branch. This should be fixed, too.
Technical Detail
When GWT loads a user project, it loads it through method StudioServiceImpl#getProject(String):
@Override public ProjectModel getProject(String projectId) throws ProjectNotFoundException, BranchNotFoundException, IOException, ValidationErrorBundle, TargetPlatformNotFoundException { ... try { userWs = userPrefsService.getUserWorkspace(projectId, principal); } catch (BranchNotFoundException e) { // it seems the user prefs point at a non existing branch. We fall back to the default one: UserPrefs userPrefs = userPrefsService.getUserPrefs(projectId, principal.getName()); userPrefs.setActiveBranch(BranchService.DEFAULT_BRANCH_NAME); userPrefsService.updateUserPrefs(projectId, userPrefs); throw e; } ... }
During the workspace loading phrase, if a branch is not found, UserPrefsService should raise a BranchNotFoundException so that Studio service can fallback to the default branch. However, this exception is not always raised:
- If user has write access and his active working branch is missing, then we create it again.
- If user has write access and his active branch is missing, then there's no check.
- If user does not have write access, then we checkout the active branch.
This ticket aims to fix the situation 2, where the active branch is missing. In other words, when the base branch of the current WIP branch is missing, we raise a BranchNotFoundException.
- links to