Skip to content

Commit 7d96660

Browse files
committed
Fix a bug in reset
1 parent 93bcf24 commit 7d96660

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/renderer/helpers/repo-state.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,12 @@ export class RepoState {
317317
}
318318

319319
async reset(target: Git.Commit, resetType: Git.Reset.TYPE) {
320-
Git.Reset.reset(this.repo, target, resetType, {});
320+
try {
321+
const commit = await this.repo.getCommit(target); // We need to reload the commit otherwise "Repository and target commit's repository does not match" is thrown
322+
await Git.Reset.reset(this.repo, commit, resetType, {});
323+
} catch(e) {
324+
this.onNotification(`Unable to reset to ${target.sha()}: ${e.message}`, NotificationType.Error);
325+
}
321326
}
322327

323328
// Index operations

0 commit comments

Comments
 (0)