Skip to content

Commit

Permalink
fix restore behavior of "discard changes"
Browse files Browse the repository at this point in the history
  • Loading branch information
letmaik committed Aug 5, 2023
1 parent d7d1016 commit a26e916
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.15.1

* Fixed "Discard Changes" incorrectly restoring files to base ref instead of merge base

## 1.15.0

* Added "Discard Changes" button to restore files with contents from the base ref [#90](https://github.com/letmaik/vscode-git-tree-compare/issues/90)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "git-tree-compare",
"displayName": "Git Tree Compare",
"description": "Diff your worktree against a branch, tag, or commit in a tree -- especially useful for pull request preparation or merge preview",
"version": "1.15.0",
"version": "1.15.1",
"author": {
"name": "Maik Riechert",
"url": "https://github.com/letmaik"
Expand Down
4 changes: 2 additions & 2 deletions src/treeProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ export class GitTreeCompareProvider implements TreeDataProvider<Element>, Dispos
}
prompts.push([msg, 'Restore File']);
actions.push(async () => {
await this.repository!.checkout(this.baseRef, [diffStatus.dstAbsPath]);
await this.repository!.checkout(this.mergeBase, [diffStatus.dstAbsPath]);
});
} else if (diffStatus.status === 'R') {
const srcFolder = path.dirname(diffStatus.srcAbsPath);
Expand All @@ -910,7 +910,7 @@ export class GitTreeCompareProvider implements TreeDataProvider<Element>, Dispos
prompts.push([msg, 'Restore File']);
actions.push(async () => {
await rmFile(this.repository!, diffStatus.dstAbsPath);
await this.repository!.checkout(this.baseRef, [diffStatus.srcAbsPath]);
await this.repository!.checkout(this.mergeBase, [diffStatus.srcAbsPath]);
});
} else {
window.showInformationMessage(
Expand Down

0 comments on commit a26e916

Please sign in to comment.