Skip to content

Commit c712f60

Browse files
authored
Merge pull request #511 from raymond-rebbeck/main
Improve handling of truncated class names from git pull
2 parents 6ad5fe0 + 04d7872 commit c712f60

File tree

2 files changed

+29
-11
lines changed

2 files changed

+29
-11
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1919
- Fixed the back button navigation between WebUI and Settings page (#361)
2020
- Basic mode Sync operation now imports items changed on the remote merge branch (#506)
2121
- Fetch diff output uses correct remote branch (#509)
22+
- Properly handle more cases of truncated filenames from git pull (#511)
2223

2324
## [2.5.0] - 2024-09-24
2425

cls/SourceControl/Git/Utils.cls

+28-11
Original file line numberDiff line numberDiff line change
@@ -1860,13 +1860,18 @@ ClassMethod SyncIrisWithRepoThroughCommand(ByRef outStream) As %Status
18601860
// In other cases, we'll just end up logging the invalid externalName.
18611861
if $Piece(externalName,".",*) = "cls" {
18621862
set possibleClasses = ..ExpandClasses(externalName)
1863-
set pointer = 0
1864-
while $ListNext(possibleClasses,pointer,class) {
1865-
set modification = ##class(SourceControl.Git.Modification).%New()
1866-
set modification.changeType = "C"
1867-
set modification.internalName = class_".CLS"
1868-
set modification.externalName = ..ExternalName(modification.internalName)
1869-
set files($i(files)) = modification
1863+
if $ListLength(possibleClasses) '= 0 {
1864+
set pointer = 0
1865+
while $ListNext(possibleClasses,pointer,class) {
1866+
set modification = ##class(SourceControl.Git.Modification).%New()
1867+
set modification.changeType = "C"
1868+
set modification.internalName = class_".CLS"
1869+
set modification.externalName = ..ExternalName(modification.internalName)
1870+
set files($i(files)) = modification
1871+
}
1872+
} else {
1873+
write !,"WARNING: unable to translate external name ",externalName
1874+
continue
18701875
}
18711876
} else {
18721877
write !,"WARNING: unable to translate external name ",externalName
@@ -1901,10 +1906,22 @@ ClassMethod ExpandClasses(externalName As %String) As %List
19011906
set internalName = $Piece(externalName,".",1,*-1)
19021907
set internalName = $Extract(internalName,4,*)
19031908
set internalName = $Translate(internalName,"/\%",".."_..PercentClassReplace())
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-
}
1909+
do {
1910+
&sql(select %DLIST(Name) into :classes from %Dictionary.ClassDefinition where Name like '%'||:internalName)
1911+
if (SQLCODE < 0) {
1912+
Throw ##class(%Exception.SQL).CreateFromSQLCODE(SQLCODE,%msg)
1913+
}
1914+
1915+
// If nothing was found then remove period-delimited pieces from the start of internalName
1916+
// until we either find something or run out of pieces.
1917+
// This will allow for classes to potentially still be identified when the
1918+
// repository directory structure does not align with class packages.
1919+
if ($ListLength(classes) = 0) {
1920+
set internalName = $Piece(internalName,".",2,*)
1921+
} else {
1922+
set internalName = ""
1923+
}
1924+
} while (internalName '= "")
19081925
quit classes
19091926
}
19101927

0 commit comments

Comments
 (0)