Fix pull failure when deleted items have no internal or external name#849
Fix pull failure when deleted items have no internal or external name#849isc-pbarton merged 3 commits intointersystems:mainfrom
Conversation
| do ##class(SourceControl.Git.Utils).RemoveRoutineTSH(item) | ||
| if (filename = "") || '##class(%File).Exists(filename) { | ||
| if (item '= "") { | ||
| do ##class(SourceControl.Git.Utils).RemoveRoutineTSH(item) |
There was a problem hiding this comment.
For the sake of completeness, you should also update RemoveRoutineTSH() to validate the input is not null because that is called from a few different places:
ClassMethod RemoveRoutineTSH(InternalName As %String) As %Status
{
Quit:(InternalName = "") $$$OK
Set tInternalName = ##class(%Studio.SourceControl.Interface).normalizeName(InternalName)
Quit:(tInternalName = "") $$$OK
Kill @..#Storage@("TSH", tInternalName)
Quit $$$OK
}
There was a problem hiding this comment.
Thanks, it's a good idea and I have implemented it.
The reason I've kept the filename = "" check is because the behaviour of %File.Exists() did not seem to be explicitly defined in the documentation or in the code for a null string input. It seems sensible to me to not bother checking for the existence of a file using a filename when we may not actually have one.
…ble null subscript error Co-authored-by: Cameron M <[email protected]>
1442ce0 to
9165ff9
Compare
|
I just tested to verify this PR fixes the issue I reported in #844. I made a branch starting at a point with the bad file name, pushed a commit fixing my config file + renaming the schema file, then running "pull" from the sc menu. My "Broken" Schema config: "HL7":{
"*":{
"directory":"schemas/hl7"
}
}My fixed schema config: "HL7": {
"*": {
"directory": "schemas/hl7/",
"noFolders": true
}
}my "Pull" output: Not sure where the "Page does not exist" error is coming from, but that seemed to not matter because after pulling the rename commit, my custom schema had been loaded. |
The "Page does not exist" error is due to |
Fixes #848
Gracefully handle
filenameoritembeing empty strings inside##class(SourceControl.Git.PullEventHandler.IncrementalLoad).DeleteFile()Commit 7d52f33 causes
filenameto be an empty string more readily. Which results in the first part of the if statement being executed, ifitemis an empty string too then##class(SourceControl.Git.Utils).RemoveRoutineTSHwill throw an exception and cause the pull to fail.As described in fixed issue, was observed with an .xsd file that was present in a Git repo and then deleted. Pull would fail when handling the deletion of this file that had no external or internal name.