Changing branches in a merge request clears all details from the merge request
Problem to solve
After git pushing a change set, git returns a message like:
remote: remote: To create a merge request for [branch name], visit: remote: https://[site and project url]/merge_requests/new?merge_request%5Bsource_branch%5D=[branch name] remote:
Visiting this URL brings up a merge request form with title and description near the top, and target branch near the bottom (actually off the screen on my monitor).
The natural thing to do is fill in the form from top to bottom. When you reach the target branch part, if it's not the default (develop, in our case), then you have to change branches. Changing branches brings up a separate window, and, after having selected the correct target branch and clicking "Compare branches and continue" you are returned to the main form, with all data you entered wiped out.
Further details
We store the title and description in local storage in case the page is closed, but it is keyed on both source_branch
and target_branch
. This means after changing the target branch the data isn't loaded.
Proposal
Update the local storage cache to only use the source_branch
in the key, so that if the target branch changes the description and title will be persisted.
Beware when updating the keys to localStorage to make sure we follow this logic:
- if pair source<->target branch entry exists
- if not, check only source branch entry exists.