Skip to content

Commit 385cf6a

Browse files
Make multiple attempts to expand truncated class names after failing to find any matches
1 parent f3fd329 commit 385cf6a

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

cls/SourceControl/Git/Utils.cls

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1900,10 +1900,22 @@ ClassMethod ExpandClasses(externalName As %String) As %List
19001900
set internalName = $Piece(externalName,".",1,*-1)
19011901
set internalName = $Extract(internalName,4,*)
19021902
set internalName = $Translate(internalName,"/\%",".."_..PercentClassReplace())
1903-
&sql(select %DLIST(Name) into :classes from %Dictionary.ClassDefinition where Name like '%'||:internalName)
1904-
if (SQLCODE < 0) {
1905-
Throw ##class(%Exception.SQL).CreateFromSQLCODE(SQLCODE,%msg)
1906-
}
1903+
do {
1904+
&sql(select %DLIST(Name) into :classes from %Dictionary.ClassDefinition where Name like '%'||:internalName)
1905+
if (SQLCODE < 0) {
1906+
Throw ##class(%Exception.SQL).CreateFromSQLCODE(SQLCODE,%msg)
1907+
}
1908+
1909+
// If nothing was found then remove period-delimited pieces from the start of internalName
1910+
// until we either find something or run out of pieces.
1911+
// This will allow for classes to potentially still be identified when the
1912+
// repository directory structure does not align with class packages.
1913+
if ($ListLength(classes) = 0) {
1914+
set internalName = $Piece(internalName,".",2,*)
1915+
} else {
1916+
set internalName = ""
1917+
}
1918+
} while (internalName '= "")
19071919
quit classes
19081920
}
19091921

0 commit comments

Comments
 (0)