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:
authorPhil Hughes <me@iamphill.com>2018-07-27 17:16:33 +0300
committerPhil Hughes <me@iamphill.com>2018-07-30 13:45:16 +0300
commite7fe50bf6cd2d4019790c644b570042b70a3a7d7 (patch)
treee90ad9345817769ec9beff6f1aa0494eaa01d57f /app/assets/javascripts/ide/stores/utils.js
parent73473dfc7be654f2f4feffef200cafe24229a698 (diff)
rename files
not working for folders yet
Diffstat (limited to 'app/assets/javascripts/ide/stores/utils.js')
-rw-r--r--app/assets/javascripts/ide/stores/utils.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/app/assets/javascripts/ide/stores/utils.js b/app/assets/javascripts/ide/stores/utils.js
index bf7ab93ff5e..5f0e425d2d3 100644
--- a/app/assets/javascripts/ide/stores/utils.js
+++ b/app/assets/javascripts/ide/stores/utils.js
@@ -47,6 +47,8 @@ export const dataStructure = () => ({
lastOpenedAt: 0,
mrChange: null,
deleted: false,
+ prevPath: '',
+ moved: false,
});
export const decorateData = entity => {
@@ -107,7 +109,9 @@ export const setPageTitle = title => {
};
export const commitActionForFile = file => {
- if (file.deleted) {
+ if (file.prevPath !== '') {
+ return 'move';
+ } else if (file.deleted) {
return 'delete';
} else if (file.tempFile) {
return 'create';
@@ -118,6 +122,8 @@ export const commitActionForFile = file => {
export const getCommitFiles = (stagedFiles, deleteTree = false) =>
stagedFiles.reduce((acc, file) => {
+ if (file.moved) return acc;
+
if ((file.deleted || deleteTree) && file.type === 'tree') {
return acc.concat(getCommitFiles(file.tree, true));
}
@@ -134,9 +140,10 @@ export const createCommitPayload = ({ branch, getters, newBranch, state, rootSta
actions: getCommitFiles(rootState.stagedFiles).map(f => ({
action: commitActionForFile(f),
file_path: f.path,
+ previous_path: f.prevPath === '' ? undefined : f.prevPath,
content: f.content,
encoding: f.base64 ? 'base64' : 'text',
- last_commit_id: newBranch || f.deleted ? undefined : f.lastCommitSha,
+ last_commit_id: newBranch || f.deleted || f.prevPath ? undefined : f.lastCommitSha,
})),
start_branch: newBranch ? rootState.currentBranchId : undefined,
});