summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2018-08-28 08:06:40 +0000
committerPhil Hughes <me@iamphill.com>2018-08-28 08:06:40 +0000
commitee578b0756cfd94517aa326da1743397ca803481 (patch)
treecd232638d5ac5f06073060b500403276e5d07058
parenta1f1460ae5eafb44c25eeb2fae5102618fafe55f (diff)
parent6bb08542579739ec5806a2dfe61c1f7c3c56a1f5 (diff)
downloadgitlab-ce-ee578b0756cfd94517aa326da1743397ca803481.tar.gz
Merge branch '50584-fix-ide-commit-twice' into 'master'
Resolve "It's impossible to commit twice to the same branch" Closes #50584 See merge request gitlab-org/gitlab-ce!21372
-rw-r--r--app/assets/javascripts/ide/stores/mutations.js8
-rw-r--r--changelogs/unreleased/50584-fix-ide-commit-twice.yml5
-rw-r--r--spec/javascripts/ide/stores/modules/commit/actions_spec.js28
3 files changed, 21 insertions, 20 deletions
diff --git a/app/assets/javascripts/ide/stores/mutations.js b/app/assets/javascripts/ide/stores/mutations.js
index 56a8d9430c7..0347f803757 100644
--- a/app/assets/javascripts/ide/stores/mutations.js
+++ b/app/assets/javascripts/ide/stores/mutations.js
@@ -146,13 +146,7 @@ export default {
staged: false,
prevPath: '',
moved: false,
- lastCommit: Object.assign(state.entries[file.path].lastCommit, {
- id: lastCommit.commit.id,
- url: lastCommit.commit_path,
- message: lastCommit.commit.message,
- author: lastCommit.commit.author_name,
- updatedAt: lastCommit.commit.authored_date,
- }),
+ lastCommitSha: lastCommit.commit.id,
});
if (prevPath) {
diff --git a/changelogs/unreleased/50584-fix-ide-commit-twice.yml b/changelogs/unreleased/50584-fix-ide-commit-twice.yml
new file mode 100644
index 00000000000..92b292cf4ab
--- /dev/null
+++ b/changelogs/unreleased/50584-fix-ide-commit-twice.yml
@@ -0,0 +1,5 @@
+---
+title: Fix Web IDE unable to commit to same file twice
+merge_request: 21372
+author:
+type: fixed
diff --git a/spec/javascripts/ide/stores/modules/commit/actions_spec.js b/spec/javascripts/ide/stores/modules/commit/actions_spec.js
index 24a7d76f30b..06b8b452319 100644
--- a/spec/javascripts/ide/stores/modules/commit/actions_spec.js
+++ b/spec/javascripts/ide/stores/modules/commit/actions_spec.js
@@ -184,7 +184,7 @@ describe('IDE commit module actions', () => {
branch,
})
.then(() => {
- expect(f.lastCommit.message).toBe(data.message);
+ expect(f.lastCommitSha).toBe(data.id);
})
.then(done)
.catch(done.fail);
@@ -266,19 +266,21 @@ describe('IDE commit module actions', () => {
});
describe('success', () => {
+ const COMMIT_RESPONSE = {
+ id: '123456',
+ short_id: '123',
+ message: 'test message',
+ committed_date: 'date',
+ stats: {
+ additions: '1',
+ deletions: '2',
+ },
+ };
+
beforeEach(() => {
spyOn(service, 'commit').and.returnValue(
Promise.resolve({
- data: {
- id: '123456',
- short_id: '123',
- message: 'test message',
- committed_date: 'date',
- stats: {
- additions: '1',
- deletions: '2',
- },
- },
+ data: COMMIT_RESPONSE,
}),
);
});
@@ -352,8 +354,8 @@ describe('IDE commit module actions', () => {
store
.dispatch('commit/commitChanges')
.then(() => {
- expect(store.state.entries[store.state.openFiles[0].path].lastCommit.message).toBe(
- 'test message',
+ expect(store.state.entries[store.state.openFiles[0].path].lastCommitSha).toBe(
+ COMMIT_RESPONSE.id,
);
done();