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

This commit is contained in:
Paul Slaughter 2018-08-28 08:06:40 +00:00 committed by Phil Hughes
parent a1f1460ae5
commit 6bb0854257
3 changed files with 21 additions and 20 deletions

View File

@ -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) {

View File

@ -0,0 +1,5 @@
---
title: Fix Web IDE unable to commit to same file twice
merge_request: 21372
author:
type: fixed

View File

@ -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();