diff options
author | Paul Slaughter <pslaughter@gitlab.com> | 2019-06-17 12:53:58 -0500 |
---|---|---|
committer | Paul Slaughter <pslaughter@gitlab.com> | 2019-06-17 14:04:35 -0500 |
commit | 894ad6f6e983cb17c7b63b4185c63a42b6203a4f (patch) | |
tree | bd3990e5b4fe0e9521287bf0c327925a82084c50 /app/assets/javascripts/ide/services | |
parent | 89a89b3230717920410de6fb6d6b7152ef41a03e (diff) | |
download | gitlab-ce-894ad6f6e983cb17c7b63b4185c63a42b6203a4f.tar.gz |
Fix IDE commit to use start_ref59023-fix-web-ide-creating-branches-off-new-commits
**Why?**
The branch HEAD could be changed since the
IDE was opened. This leads to user's unintentionally
creating commits that overwrite other changes.
https://gitlab.com/gitlab-org/gitlab-ce/issues/59023
Diffstat (limited to 'app/assets/javascripts/ide/services')
-rw-r--r-- | app/assets/javascripts/ide/services/index.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/app/assets/javascripts/ide/services/index.js b/app/assets/javascripts/ide/services/index.js index ba33b6826d6..840761f68db 100644 --- a/app/assets/javascripts/ide/services/index.js +++ b/app/assets/javascripts/ide/services/index.js @@ -56,7 +56,13 @@ export default { return Api.branchSingle(projectId, currentBranchId); }, commit(projectId, payload) { - return Api.commitMultiple(projectId, payload); + // Currently the `commit` endpoint does not support `start_sha` so we + // have to make the request in the FE. This is not ideal and will be + // resolved soon. https://gitlab.com/gitlab-org/gitlab-ce/issues/59023 + const { branch, start_sha: ref } = payload; + const branchPromise = ref ? Api.createBranch(projectId, { ref, branch }) : Promise.resolve(); + + return branchPromise.then(() => Api.commitMultiple(projectId, payload)); }, getFiles(projectUrl, branchId) { const url = `${projectUrl}/files/${branchId}`; |