Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Slaughter <pslaughter@gitlab.com>2019-06-17 20:53:58 +0300
committerPaul Slaughter <pslaughter@gitlab.com>2019-06-17 22:04:35 +0300
commit894ad6f6e983cb17c7b63b4185c63a42b6203a4f (patch)
treebd3990e5b4fe0e9521287bf0c327925a82084c50 /app/assets/javascripts/ide/services
parent89a89b3230717920410de6fb6d6b7152ef41a03e (diff)
Fix IDE commit to use start_ref
**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.js8
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}`;