summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/ide/stores/modules/commit/actions.js
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2018-04-19 14:13:16 +0100
committerPhil Hughes <me@iamphill.com>2018-04-19 14:13:16 +0100
commit5d1d5830ac728a59b6f12cccddbe185956c68a39 (patch)
tree4d6b92fef3d4166a51dcfa7a059e0bbb8c464397 /app/assets/javascripts/ide/stores/modules/commit/actions.js
parent356a37cf50a3a164dd6004ed06f310895539105a (diff)
parent54e262965d213ad7b3b258f54805485c3110040a (diff)
downloadgitlab-ce-5d1d5830ac728a59b6f12cccddbe185956c68a39.tar.gz
Merge branch 'master' into ide-temp-file-folder-fixes
Diffstat (limited to 'app/assets/javascripts/ide/stores/modules/commit/actions.js')
-rw-r--r--app/assets/javascripts/ide/stores/modules/commit/actions.js34
1 files changed, 15 insertions, 19 deletions
diff --git a/app/assets/javascripts/ide/stores/modules/commit/actions.js b/app/assets/javascripts/ide/stores/modules/commit/actions.js
index 7964244743b..e7ac60d01cf 100644
--- a/app/assets/javascripts/ide/stores/modules/commit/actions.js
+++ b/app/assets/javascripts/ide/stores/modules/commit/actions.js
@@ -98,23 +98,14 @@ export const updateFilesAfterCommit = (
{ root: true },
);
- rootState.changedFiles.forEach(entry => {
- commit(
- rootTypes.SET_LAST_COMMIT_DATA,
- {
- entry,
- lastCommit,
- },
- { root: true },
- );
-
- eventHub.$emit(`editor.update.model.content.${entry.path}`, entry.content);
+ rootState.stagedFiles.forEach(file => {
+ const changedFile = rootState.changedFiles.find(f => f.path === file.path);
commit(
- rootTypes.SET_FILE_RAW_DATA,
+ rootTypes.UPDATE_FILE_AFTER_COMMIT,
{
- file: entry,
- raw: entry.content,
+ file,
+ lastCommit,
},
{ root: true },
);
@@ -122,18 +113,21 @@ export const updateFilesAfterCommit = (
commit(
rootTypes.TOGGLE_FILE_CHANGED,
{
- file: entry,
+ file,
changed: false,
},
{ root: true },
);
- dispatch('updateTempFlagForEntry', { entry, tempFile: false }, { root: true });
- });
+ dispatch('updateTempFlagForEntry', { file, tempFile: false }, { root: true });
- commit(rootTypes.REMOVE_ALL_CHANGES_FILES, null, { root: true });
+ eventHub.$emit(`editor.update.model.content.${file.key}`, {
+ content: file.content,
+ changed: !!changedFile,
+ });
+ });
- if (state.commitAction === consts.COMMIT_TO_NEW_BRANCH) {
+ if (state.commitAction === consts.COMMIT_TO_NEW_BRANCH && rootGetters.activeFile) {
router.push(
`/project/${rootState.currentProjectId}/blob/${branch}/${rootGetters.activeFile.path}`,
);
@@ -186,6 +180,8 @@ export const commitChanges = ({ commit, state, getters, dispatch, rootState }) =
{ root: true },
);
}
+
+ commit(rootTypes.CLEAR_STAGED_CHANGES, null, { root: true });
})
.then(() => dispatch('updateCommitAction', consts.COMMIT_TO_CURRENT_BRANCH));
})