From 3d5f8fb5e870f9234453cbb9f69aeef437699276 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Thu, 2 Aug 2018 11:01:25 +0100 Subject: [PATCH] removed un-used code fixed folder deletions not adding to changedFiles --- app/assets/javascripts/ide/stores/mutations.js | 2 +- app/assets/javascripts/ide/stores/utils.js | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/ide/stores/mutations.js b/app/assets/javascripts/ide/stores/mutations.js index a8b0aad25fa..bc6e23fc386 100644 --- a/app/assets/javascripts/ide/stores/mutations.js +++ b/app/assets/javascripts/ide/stores/mutations.js @@ -199,7 +199,7 @@ export default { entry.deleted = true; - parent.tree.splice(parent.tree.findIndex(f => f.path === entry.path), 1); + parent.tree = parent.tree.filter(f => f.path !== entry.path); if (entry.type === 'blob') { state.changedFiles = state.changedFiles.concat(entry); diff --git a/app/assets/javascripts/ide/stores/utils.js b/app/assets/javascripts/ide/stores/utils.js index 6d4941e9c32..fba1f70bf6c 100644 --- a/app/assets/javascripts/ide/stores/utils.js +++ b/app/assets/javascripts/ide/stores/utils.js @@ -121,17 +121,12 @@ export const commitActionForFile = file => { return 'update'; }; -export const getCommitFiles = (stagedFiles, deleteTree = false) => +export const getCommitFiles = stagedFiles => stagedFiles.reduce((acc, file) => { if (file.moved) return acc; - if ((file.deleted || deleteTree || file.prevPath) && file.type === 'tree') { - return acc.concat(getCommitFiles(file.tree, true)); - } - return acc.concat({ ...file, - deleted: deleteTree || file.deleted, }); }, []);