This commit is contained in:
João Moreno 2020-12-04 11:43:10 +01:00
parent 6a1ad5b9b8
commit 0c947cb4ee
No known key found for this signature in database
GPG key ID: 896B853774D1A575
2 changed files with 5 additions and 5 deletions

View file

@ -54,7 +54,7 @@ class CheckoutRemoteHeadItem extends CheckoutItem {
return localize('remote branch at', "Remote branch at {0}", this.shortCommit);
}
async run(repository: Repository): Promise<void> {
async run(repository: Repository, opts?: { detached?: boolean }): Promise<void> {
if (!this.ref.name) {
return;
}
@ -62,9 +62,9 @@ class CheckoutRemoteHeadItem extends CheckoutItem {
const branches = await repository.findTrackingBranches(this.ref.name);
if (branches.length > 0) {
await repository.checkout(branches[0].name!);
await repository.checkout(branches[0].name!, opts);
} else {
await repository.checkoutTracking(this.ref.name);
await repository.checkoutTracking(this.ref.name, opts);
}
}
}

View file

@ -1264,8 +1264,8 @@ export class Repository implements Disposable {
await this.run(Operation.Checkout, () => this.repository.checkout(treeish, [], opts));
}
async checkoutTracking(treeish: string): Promise<void> {
await this.run(Operation.CheckoutTracking, () => this.repository.checkout(treeish, [], { track: true }));
async checkoutTracking(treeish: string, opts: { detached?: boolean } = {}): Promise<void> {
await this.run(Operation.CheckoutTracking, () => this.repository.checkout(treeish, [], { ...opts, track: true }));
}
async findTrackingBranches(upstreamRef: string): Promise<Branch[]> {