Skip to content

Commit 6959f31

Browse files
azure-sdkhallipr
andauthored
Avoid adding the same package twice, use TrimStart instead of substring (Azure#37193)
Co-authored-by: Patrick Hallisey <[email protected]>
1 parent 63e43ca commit 6959f31

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

eng/common/scripts/Package-Properties.ps1

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ function Get-PrPkgProperties([string]$InputDiffJson) {
119119
foreach ($pkg in $allPackageProperties)
120120
{
121121
$pkgDirectory = Resolve-Path "$($pkg.DirectoryPath)"
122-
$lookupKey = ($pkg.DirectoryPath).Replace($RepoRoot, "").SubString(1)
122+
$lookupKey = ($pkg.DirectoryPath).Replace($RepoRoot, "").TrimStart('\/')
123123
$lookup[$lookupKey] = $pkg
124124

125125
foreach ($file in $targetedFiles)
@@ -132,12 +132,15 @@ function Get-PrPkgProperties([string]$InputDiffJson) {
132132
if ($pkg.AdditionalValidationPackages) {
133133
$additionalValidationPackages += $pkg.AdditionalValidationPackages
134134
}
135+
136+
# avoid adding the same package multiple times
137+
break
135138
}
136139
}
137140
}
138141

139142
foreach ($addition in $additionalValidationPackages) {
140-
$key = $addition.Replace($RepoRoot, "").SubString(1)
143+
$key = $addition.Replace($RepoRoot, "").TrimStart('\/')
141144

142145
if ($lookup[$key]) {
143146
$packagesWithChanges += $lookup[$key]

0 commit comments

Comments
 (0)