Skip to content

Commit

Permalink
Merge pull request #829 from ianhi/issue828
Browse files Browse the repository at this point in the history
don't check for changed files when checking out a new branch
  • Loading branch information
fcollonval authored Nov 26, 2020
2 parents 1a57cab + f7d0bb2 commit 3b6613a
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,15 +384,17 @@ export class GitExtension implements IGitExtension {
'git:checkout',
async () => {
let changes;
if (body.checkout_branch) {
changes = await this._changedFiles(
this._currentBranch.name,
body.branchname
);
} else if (body.filename) {
changes = { files: [body.filename] };
} else {
changes = await this._changedFiles('WORKING', 'HEAD');
if (!body.new_check) {
if (body.checkout_branch && !body.new_check) {
changes = await this._changedFiles(
this._currentBranch.name,
body.branchname
);
} else if (body.filename) {
changes = { files: [body.filename] };
} else {
changes = await this._changedFiles('WORKING', 'HEAD');
}
}

const d = await requestAPI<Git.ICheckoutResult>(
Expand All @@ -401,7 +403,7 @@ export class GitExtension implements IGitExtension {
body
);

changes.files?.forEach(file => this._revertFile(file));
changes?.files?.forEach(file => this._revertFile(file));
return d;
}
);
Expand Down

0 comments on commit 3b6613a

Please sign in to comment.