@@ -388,19 +388,21 @@ async function TryGetHTMLLinkNameAndUrlForArtifactLink(artifactLink)
388
388
}
389
389
390
390
// TODO:
391
- // - Resolve project and repository ids for better display?
391
+ // - Resolve project and repository ids for better display? I.e. in the history, show the project and repository names?
392
392
// - Support all other artifact link types.
393
393
// - Maybe call routeUrl() at the start of the initialization to trigger the REST request as early as possible?
394
+ // - TFS code references? (Compare e.g. constructLinkToContentFromRouteId())
394
395
395
396
const [ , artifactTool , artifactType , artifactId ] = matches ;
396
397
if ( artifactTool === 'Git' ) {
398
+ // Example: vstfs:///Git/Commit/2d63f741-0ba0-4bc6-b730-896745fab2c0%2Fc0d1232d-66e9-4d5e-b5a0-50366bc67991%2F2054d8fcd16469d4398b2c73d9da828aaed98e41
397
399
if ( artifactType === 'Commit' ) {
398
400
const details = artifactId . split ( '%2F' ) ;
399
401
if ( details . length !== 3 ) {
400
402
return undefined ;
401
403
}
402
404
403
- // Compare the 'VersionControl/Scripts/CommitArtifact.js' file in the ADO Server installation.
405
+ // Compare 'VersionControl/Scripts/CommitArtifact.js' and 'wit-linked-work-dropdown-content\Util\Artifact.js' in the ADO Server installation.
404
406
const [ projectGuid , repositoryId , commitId ] = details ;
405
407
406
408
/*
@@ -414,14 +416,47 @@ async function TryGetHTMLLinkNameAndUrlForArtifactLink(artifactLink)
414
416
],
415
417
*/
416
418
const url = await gLocationService . routeUrl (
417
- " ms.vss-code-web.commit-route" ,
419
+ ' ms.vss-code-web.commit-route' ,
418
420
{
419
421
project : projectGuid ,
420
422
'vc.GitRepositoryName' : repositoryId ,
421
423
parameters : commitId
422
424
} ) ;
423
425
return [ commitId , url ] ;
424
426
}
427
+ // Example: vstfs:///Git/Ref/2d63f741-0ba0-4bc6-b730-896745fab2c0%2Fc0d1232d-66e9-4d5e-b5a0-50366bc67991%2FGBmain
428
+ else if ( artifactType === 'Ref' ) {
429
+ const details = artifactId . split ( '%2F' ) ;
430
+ if ( details . length !== 3 ) {
431
+ return undefined ;
432
+ }
433
+
434
+ // Compare 'wit-linked-work-dropdown-content\Util\Artifact.js' as well as
435
+ // constructLinkToContentFromRouteId() in 'Search\Scenarios\Shared\Utils.js' in the ADO Server installation.
436
+ // Git branches are prefixed with 'GB' (I guess it stands for 'Git Branch'?) (TFS branches are prefixed with 'T').
437
+ const [ projectGuid , repositoryId , branchNameWithGB ] = details ;
438
+ if ( branchNameWithGB . indexOf ( 'GB' ) !== 0 ) {
439
+ // TODO: Is 'Git/Ref' used only for branches, or also for other things?
440
+ return undefined ;
441
+ }
442
+ const branchName = branchNameWithGB . substring ( 2 ) ;
443
+
444
+ /*
445
+ "routeTemplates": [
446
+ "{project}/{team}/_git/{vc.GitRepositoryName}",
447
+ "{project}/_git/{vc.GitRepositoryName}",
448
+ "_git/{project}"
449
+ ],
450
+ */
451
+ const url = await gLocationService . routeUrl (
452
+ 'ms.vss-code-web.files-route-git' ,
453
+ {
454
+ project : projectGuid ,
455
+ 'vc.GitRepositoryName' : repositoryId ,
456
+ version : branchNameWithGB
457
+ } ) ;
458
+ return [ branchName , url ] ;
459
+ }
425
460
}
426
461
427
462
// Unknown artifact link.
0 commit comments