Skip to content

Commit 646d0ca

Browse files
committed
Added git path interpretation
1 parent ba7fd7c commit 646d0ca

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1717
- Fix left-sidebar spacing (#525)
1818
- Fixed slowness loading some CSP pages with multiple instances sharing a webserver (#540)
1919
- Prevent direct commits to default merge branch in basic mode (#484)
20+
- Fixed git path configuration (#463)
2021

2122
## [2.6.0] - 2024-10-07
2223

cls/SourceControl/Git/Settings.cls

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,13 @@ ClassMethod Configure() As %Boolean [ CodeMode = objectgenerator ]
170170
set propertyDef = ##class(%Dictionary.PropertyDefinition).%OpenId("SourceControl.Git.Settings||"_property_"")
171171
if ((propertyDef) && (propertyDef.Type = "%Boolean")) {
172172
do %code.WriteLine(" set response = ##class(%Library.Prompt).GetYesNo("_promptQuoted_",.value,,"_defaultPromptFlag_")")
173+
} elseif ((propertyDef) && (propertyDef.Name = "gitBinPath")) {
174+
do %code.WriteLine(" set valid = 0")
175+
do %code.WriteLine(" while ('valid) {")
176+
do %code.WriteLine(" set response = ##class(%Library.Prompt).GetString("_promptQuoted_",.value,,,,"_defaultPromptFlag_")")
177+
do %code.WriteLine(" set status = inst.ConfigureBinPath(.value)")
178+
do %code.WriteLine(" if (status) { set valid = 1 }")
179+
do %code.WriteLine(" }")
173180
} elseif ((propertyDef) && (propertyDef.Name = "basicMode")) {
174181
set basicModePromptFlag = defaultPromptFlag + $$$MatchExactArrayMask + $$$InitialDisplayMask
175182
do %code.WriteLine(" set list(1) = ""Yes""")
@@ -341,4 +348,35 @@ Method OnAfterConfigure() As %Boolean
341348
}
342349
}
343350

351+
Method ConfigureBinPath(ByRef path As %String) As %Boolean
352+
{
353+
if (path = "") { return 1 }
354+
// Sometimes path is quoted
355+
set path = $replace(path,"""","")
356+
if (##class(%File).DirectoryExists(path)) {
357+
set path = ##class(%File).Construct(path, "git.exe")
358+
}
359+
360+
if (##class(%File).Exists(path)) {
361+
// no-op
362+
} else {
363+
write !, "The entered path is not a valid path, please try again"
364+
return 0
365+
}
366+
try {
367+
set sysStorage = ##class(SourceControl.Git.Utils).%SYSNamespaceStorage()
368+
kill @sysStorage@("%gitBinPath")
369+
if (..gitBinPath '= "") {
370+
set @sysStorage@("%gitBinPath") = path
371+
}
372+
kill ^||GitVersion
373+
// Get and write the version
374+
set gitExists = ##class(SourceControl.Git.Utils).GitBinExists(.version)
375+
write !, "You are now using "_version
376+
} catch e {
377+
// no-op, user may not have privileges
378+
}
379+
return 1
380+
}
381+
344382
}

0 commit comments

Comments
 (0)