Checkout specific branch during clone operation (#163705)

This commit is contained in:
Joyce Er
2022-10-23 11:23:35 -07:00
committed by GitHub
parent 0492b9237f
commit 7318c90996
2 changed files with 5 additions and 14 deletions

View File

@@ -361,6 +361,7 @@ export interface ICloneOptions {
readonly parentPath: string;
readonly progress: Progress<{ increment: number }>;
readonly recursive?: boolean;
readonly ref?: string;
}
export class Git {
@@ -455,6 +456,9 @@ export class Git {
if (options.recursive) {
command.push('--recursive');
}
if (options.ref) {
command.push('--branch', `'${options.ref}'`);
}
await this.exec(options.parentPath, command, {
cancellationToken,
env: { 'GIT_HTTP_USER_AGENT': this.userAgent },