Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Changes to % routines mapped to the current namespace may now be added to source control and committed (#944)
- Edits to a decomposed production in VS Code fixed after changes to the VS Code ObjectScript extension (#949)
- Configure prompt no longer quits out with an unhelpful error if existing boolean settings are null (#962)

## [2.16.0] - 2026-03-06

Expand Down
4 changes: 3 additions & 1 deletion cls/SourceControl/Git/Settings.cls
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ ClassMethod CreateNamespaceTempFolder() As %Status [ Internal ]
return $$$OK
}

ClassMethod Configure() As %Boolean [ CodeMode = objectgenerator, Internal ]
ClassMethod Configure(Output sc As %Status = {$$$OK}) As %Boolean [ CodeMode = objectgenerator, Internal ]
{
do %code.WriteLine(" set inst = ..%New()")
do %code.WriteLine(" do inst.RetrieveDefaults()")
Expand All @@ -305,6 +305,7 @@ ClassMethod Configure() As %Boolean [ CodeMode = objectgenerator, Internal ]
set promptQuoted = $replace(promptQuoted,"${username}","'""_$Username_""'")
set propertyDef = ##class(%Dictionary.PropertyDefinition).%OpenId("SourceControl.Git.Settings||"_property_"")
if ((propertyDef) && (propertyDef.Type = "%Boolean")) {
do %code.WriteLine(" set value = ''value")
do %code.WriteLine(" set response = ##class(%Library.Prompt).GetYesNo("_promptQuoted_",.value,,"_defaultPromptFlag_")")
} elseif ((propertyDef) && (propertyDef.Name = "gitBinPath")) {
do %code.WriteLine(" set valid = 0")
Expand Down Expand Up @@ -342,6 +343,7 @@ ClassMethod Configure() As %Boolean [ CodeMode = objectgenerator, Internal ]
} else {
do %code.WriteLine(" set response = ##class(%Library.Prompt).GetString("_promptQuoted_",.value,,,,"_defaultPromptFlag_")")
}
do %code.WriteLine(" if (response = $$$ErrorResponse) { set sc = $get(%objlasterror, 0) }")
do %code.WriteLine(" if response '= $$$SuccessResponse { quit 0 }")
do %code.WriteLine(" set value = $zstrip(value,""<>W"")")
do %code.WriteLine(" set inst."_property_" = value")
Expand Down
26 changes: 26 additions & 0 deletions test/UnitTest/SourceControl/Git/Settings.cls
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,32 @@ Method TestSaveAndImportSettings()
do $$$AssertEquals(^SYS("SourceControl","Git","settings","generatedFilesReadOnly"),"1")
}

/// Configure routine should succeed when accepting all defaults.
Method TestConfigureCHUI()
{
set oldRedirectIO = ##class(%Device).ReDirectIO()
set oldIO = $io
set st = $$$OK
try {
use $io::"^"_##class(%Studio.SourceControl.ItemSet).LogTags()
do ##class(%Library.Device).ReDirectIO(1)
set configRet = ##class(SourceControl.Git.Settings).Configure(.configSC)
// test when a boolean setting is set with invalid value
set ^SYS("SourceControl","Git","settings","generatedFilesReadOnly")=""
set configWithInvalidRet = ##class(SourceControl.Git.Settings).Configure(.configWithInvalidSC)
} catch err {
set st = err.AsStatus()
}
use oldIO
do ##class(%Device).ReDirectIO(oldRedirectIO)
$$$ThrowOnError(st)
do $$$AssertTrue(configRet)
do $$$AssertStatusOK(configSC)
do $$$AssertTrue(configWithInvalidRet)
do $$$AssertStatusOK(configWithInvalidSC)
do $$$AssertEquals($get(^SYS("SourceControl","Git","settings","generatedFilesReadOnly"),""), 0)
}

Method OnBeforeAllTests() As %Status
{
merge ..SourceControlGlobal = ^SYS("SourceControl")
Expand Down
Loading