Commit 6bb08542 authored by Paul Slaughter's avatar Paul Slaughter Committed by Phil Hughes

Resolve "It's impossible to commit twice to the same branch"

parent a1f1460a
...@@ -146,13 +146,7 @@ export default { ...@@ -146,13 +146,7 @@ export default {
staged: false, staged: false,
prevPath: '', prevPath: '',
moved: false, moved: false,
lastCommit: Object.assign(state.entries[file.path].lastCommit, { lastCommitSha: lastCommit.commit.id,
id: lastCommit.commit.id,
url: lastCommit.commit_path,
message: lastCommit.commit.message,
author: lastCommit.commit.author_name,
updatedAt: lastCommit.commit.authored_date,
}),
}); });
if (prevPath) { if (prevPath) {
......
---
title: Fix Web IDE unable to commit to same file twice
merge_request: 21372
author:
type: fixed
...@@ -184,7 +184,7 @@ describe('IDE commit module actions', () => { ...@@ -184,7 +184,7 @@ describe('IDE commit module actions', () => {
branch, branch,
}) })
.then(() => { .then(() => {
expect(f.lastCommit.message).toBe(data.message); expect(f.lastCommitSha).toBe(data.id);
}) })
.then(done) .then(done)
.catch(done.fail); .catch(done.fail);
...@@ -266,10 +266,7 @@ describe('IDE commit module actions', () => { ...@@ -266,10 +266,7 @@ describe('IDE commit module actions', () => {
}); });
describe('success', () => { describe('success', () => {
beforeEach(() => { const COMMIT_RESPONSE = {
spyOn(service, 'commit').and.returnValue(
Promise.resolve({
data: {
id: '123456', id: '123456',
short_id: '123', short_id: '123',
message: 'test message', message: 'test message',
...@@ -278,7 +275,12 @@ describe('IDE commit module actions', () => { ...@@ -278,7 +275,12 @@ describe('IDE commit module actions', () => {
additions: '1', additions: '1',
deletions: '2', deletions: '2',
}, },
}, };
beforeEach(() => {
spyOn(service, 'commit').and.returnValue(
Promise.resolve({
data: COMMIT_RESPONSE,
}), }),
); );
}); });
...@@ -352,8 +354,8 @@ describe('IDE commit module actions', () => { ...@@ -352,8 +354,8 @@ describe('IDE commit module actions', () => {
store store
.dispatch('commit/commitChanges') .dispatch('commit/commitChanges')
.then(() => { .then(() => {
expect(store.state.entries[store.state.openFiles[0].path].lastCommit.message).toBe( expect(store.state.entries[store.state.openFiles[0].path].lastCommitSha).toBe(
'test message', COMMIT_RESPONSE.id,
); );
done(); done();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment