Skip to content

Commit

Permalink
[Code] update repo by set target ref directly
Browse files Browse the repository at this point in the history
  • Loading branch information
spacedragon committed Feb 26, 2019
1 parent 126eac4 commit eb308c2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions x-pack/plugins/code/server/repository_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,12 @@ export class RepositoryService {
// TODO(mengwei): deal with the case when the default branch has changed.
const currentBranch = await repo.getCurrentBranch();
const currentBranchName = currentBranch.shorthand();
await repo.mergeBranches(
currentBranchName,
`origin/${currentBranchName}`,
Git.Signature.default(repo),
Git.Merge.PREFERENCE.FASTFORWARD_ONLY
);
const originBranchName = `origin/${currentBranchName}`;
const originRef = await repo.getReference(originBranchName);
const headRef = await repo.getReference(currentBranchName);
if (!originRef.target().equal(headRef.target())) {
await headRef.setTarget(originRef.target(), 'update');
}
const headCommit = await repo.getHeadCommit();
this.log.debug(`Update repository to revision ${headCommit.sha()}`);
return {
Expand Down

0 comments on commit eb308c2

Please sign in to comment.