@@ -457,7 +457,7 @@ export class CommandCenter {
457
457
) ;
458
458
}
459
459
460
- async cloneRepository ( url ?: string , parentPath ?: string , options : { recursive ?: boolean } = { } ) : Promise < void > {
460
+ async cloneRepository ( url ?: string , parentPath ?: string , options : { recursive ?: boolean ; ref ?: string } = { } ) : Promise < void > {
461
461
if ( ! url || typeof url !== 'string' ) {
462
462
url = await pickRemoteSource ( {
463
463
providerLabel : provider => localize ( 'clonefrom' , "Clone from {0}" , provider . name ) ,
@@ -519,6 +519,11 @@ export class CommandCenter {
519
519
( progress , token ) => this . git . clone ( url ! , { parentPath : parentPath ! , progress, recursive : options . recursive } , token )
520
520
) ;
521
521
522
+ if ( options . ref !== undefined ) {
523
+ const repository = this . model . getRepository ( Uri . file ( repositoryPath ) ) ;
524
+ await repository ?. checkout ( options . ref ) ;
525
+ }
526
+
522
527
const config = workspace . getConfiguration ( 'git' ) ;
523
528
const openAfterClone = config . get < 'always' | 'alwaysNewWindow' | 'whenNoFolderOpen' | 'prompt' > ( 'openAfterClone' ) ;
524
529
@@ -596,8 +601,8 @@ export class CommandCenter {
596
601
}
597
602
598
603
@command ( 'git.clone' )
599
- async clone ( url ?: string , parentPath ?: string ) : Promise < void > {
600
- await this . cloneRepository ( url , parentPath ) ;
604
+ async clone ( url ?: string , parentPath ?: string , options ?: { ref ?: string } ) : Promise < void > {
605
+ await this . cloneRepository ( url , parentPath , options ) ;
601
606
}
602
607
603
608
@command ( 'git.cloneRecursive' )
0 commit comments