fix(git): aonly allow fast-forward merge (#4169)

fix(git): aonly allow fast-forward merge
This commit is contained in:
Michael Kriese 2019-07-24 17:20:17 +02:00 committed by Rhys Arkins
parent 709a2bc1ec
commit ceebedca3f
2 changed files with 15 additions and 1 deletions

View file

@ -338,7 +338,7 @@ export class Storage {
await this._git!.reset('hard');
await this._git!.checkout(['-B', branchName, 'origin/' + branchName]);
await this._git!.checkout(this._config.baseBranch);
await this._git!.merge([branchName]);
await this._git!.merge(['--ff-only', branchName]);
await this._git!.push('origin', this._config.baseBranch);
}

View file

@ -149,6 +149,20 @@ describe('platform/git/storage', () => {
it('should throw if branch merge throws', async () => {
await expect(git.mergeBranch('not_found')).rejects.toThrow();
});
it('should throw if branch merge is stale', async () => {
expect.assertions(1);
await git.setBranchPrefix('renovate/');
await git.commitFilesToBranch(
'test',
[{ name: 'some-new-file', contents: 'some new-contents' }],
'test mesage',
'renovate/past_branch'
);
await git.setBaseBranch('master');
await expect(git.mergeBranch('test')).rejects.toThrow();
});
});
describe('deleteBranch(branchName)', () => {
it('should send delete', async () => {