Skip to content

Commit f807d8a

Browse files
committed
fix: don't checkout when nothing changed after merge
1 parent 686c323 commit f807d8a

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

src/isomorphicGit.ts

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -413,27 +413,29 @@ export class IsomorphicGit extends GitManager {
413413
await this.fetch();
414414
const branchInfo = await this.branchInfo();
415415

416-
await this.wrapFS(
416+
const mergeRes = await this.wrapFS(
417417
git.merge({
418418
...this.getRepo(),
419419
ours: branchInfo.current,
420420
theirs: branchInfo.tracking!,
421421
abortOnConflict: false,
422422
})
423423
);
424-
await this.wrapFS(
425-
git.checkout({
426-
...this.getRepo(),
427-
ref: branchInfo.current,
428-
onProgress: (progress) => {
429-
if (progressNotice !== undefined) {
430-
(progressNotice as any).noticeEl.innerText =
431-
this.getProgressText("Checkout", progress);
432-
}
433-
},
434-
remote: branchInfo.remote,
435-
})
436-
);
424+
if (!mergeRes.alreadyMerged) {
425+
await this.wrapFS(
426+
git.checkout({
427+
...this.getRepo(),
428+
ref: branchInfo.current,
429+
onProgress: (progress) => {
430+
if (progressNotice !== undefined) {
431+
(progressNotice as any).noticeEl.innerText =
432+
this.getProgressText("Checkout", progress);
433+
}
434+
},
435+
remote: branchInfo.remote,
436+
})
437+
);
438+
}
437439
progressNotice?.hide();
438440

439441
const upstreamCommit = await this.resolveRef("HEAD");

0 commit comments

Comments
 (0)