diff options
author | Denys Mishunov <dmishunov@gitlab.com> | 2019-06-28 18:47:23 +0200 |
---|---|---|
committer | Denys Mishunov <dmishunov@gitlab.com> | 2019-07-02 09:33:55 +0200 |
commit | 56a541a26c698e5efb1105c8d304f0c43043e1ae (patch) | |
tree | 5f106eb4f8f30ccc106e445f1291b21fd04afec2 | |
parent | 818c3d8c158e5e07e7532f3c027c72340aebcd3f (diff) | |
download | gitlab-ce-60859-upload-after-delete.tar.gz |
Clean up replaced files after commit60859-upload-after-delete
6 files changed, 28 insertions, 0 deletions
diff --git a/app/assets/javascripts/ide/stores/modules/commit/actions.js b/app/assets/javascripts/ide/stores/modules/commit/actions.js index 01ca6a6b12f..ac34491c1ad 100644 --- a/app/assets/javascripts/ide/stores/modules/commit/actions.js +++ b/app/assets/javascripts/ide/stores/modules/commit/actions.js @@ -186,6 +186,8 @@ export const commitChanges = ({ commit, state, getters, dispatch, rootState, roo commit(rootTypes.CLEAR_STAGED_CHANGES, null, { root: true }); + commit(rootTypes.CLEAR_REPLACED_FILES, null, { root: true }); + setTimeout(() => { commit(rootTypes.SET_LAST_COMMIT_MSG, '', { root: true }); }, 5000); diff --git a/app/assets/javascripts/ide/stores/mutation_types.js b/app/assets/javascripts/ide/stores/mutation_types.js index 86ab76136df..f021729c451 100644 --- a/app/assets/javascripts/ide/stores/mutation_types.js +++ b/app/assets/javascripts/ide/stores/mutation_types.js @@ -60,6 +60,8 @@ export const CLEAR_STAGED_CHANGES = 'CLEAR_STAGED_CHANGES'; export const STAGE_CHANGE = 'STAGE_CHANGE'; export const UNSTAGE_CHANGE = 'UNSTAGE_CHANGE'; +export const CLEAR_REPLACED_FILES = 'CLEAR_REPLACED_FILES'; + export const UPDATE_FILE_AFTER_COMMIT = 'UPDATE_FILE_AFTER_COMMIT'; export const ADD_PENDING_TAB = 'ADD_PENDING_TAB'; export const REMOVE_PENDING_TAB = 'REMOVE_PENDING_TAB'; diff --git a/app/assets/javascripts/ide/stores/mutations.js b/app/assets/javascripts/ide/stores/mutations.js index 39ac34be2ea..ea125214ebb 100644 --- a/app/assets/javascripts/ide/stores/mutations.js +++ b/app/assets/javascripts/ide/stores/mutations.js @@ -56,6 +56,11 @@ export default { stagedFiles: [], }); }, + [types.CLEAR_REPLACED_FILES](state) { + Object.assign(state, { + replacedFiles: [], + }); + }, [types.SET_ENTRIES](state, entries) { Object.assign(state, { entries, @@ -151,6 +156,7 @@ export default { raw: file.content, changed: Boolean(changedFile), staged: false, + replaces: false, prevPath: '', moved: false, lastCommitSha: lastCommit.commit.id, diff --git a/app/assets/javascripts/ide/stores/utils.js b/app/assets/javascripts/ide/stores/utils.js index b7ee2e5c9ee..01f78a29cf6 100644 --- a/app/assets/javascripts/ide/stores/utils.js +++ b/app/assets/javascripts/ide/stores/utils.js @@ -18,6 +18,7 @@ export const dataStructure = () => ({ active: false, changed: false, staged: false, + replaces: false, lastCommitPath: '', lastCommitSha: '', lastCommit: { diff --git a/changelogs/unreleased/60859-upload-after-delete.yml b/changelogs/unreleased/60859-upload-after-delete.yml new file mode 100644 index 00000000000..c36dfb84bfe --- /dev/null +++ b/changelogs/unreleased/60859-upload-after-delete.yml @@ -0,0 +1,5 @@ +--- +title: In WebIDE allow adding new entries of the same name as deleted entry +merge_request: 30239 +author: +type: fixed diff --git a/spec/javascripts/ide/stores/mutations_spec.js b/spec/javascripts/ide/stores/mutations_spec.js index 5bd171a2186..2470c99e300 100644 --- a/spec/javascripts/ide/stores/mutations_spec.js +++ b/spec/javascripts/ide/stores/mutations_spec.js @@ -79,6 +79,16 @@ describe('Multi-file store mutations', () => { }); }); + describe('CLEAR_REPLACED_FILES', () => { + it('clears replacedFiles array', () => { + localState.replacedFiles.push('a'); + + mutations.CLEAR_REPLACED_FILES(localState); + + expect(localState.replacedFiles.length).toBe(0); + }); + }); + describe('UPDATE_VIEWER', () => { it('sets viewer state', () => { mutations.UPDATE_VIEWER(localState, 'diff'); @@ -308,6 +318,7 @@ describe('Multi-file store mutations', () => { permalink: `${gl.TEST_HOST}/testing-123`, commitsPath: `${gl.TEST_HOST}/testing-123`, blamePath: `${gl.TEST_HOST}/testing-123`, + replaces: true, }; localState.entries.test = f; localState.changedFiles.push(f); @@ -318,6 +329,7 @@ describe('Multi-file store mutations', () => { expect(f.permalink).toBe(`${gl.TEST_HOST}/test`); expect(f.commitsPath).toBe(`${gl.TEST_HOST}/test`); expect(f.blamePath).toBe(`${gl.TEST_HOST}/test`); + expect(f.replaces).toBe(false); }); }); |