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 @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Settings page now warns if Embedded Git is not the configured source control extension (#857)
- Settings page now has option to switch namespace (#856)
- SourceControl.Git.Settings is now documented as part of the public API to allow programmatic configuration of settings (#262)
- New setting to define an SSH client configuration file for connections to SSH remotes (#293)

### Fixed
- When cloning a repo with Configure, that repo's embedded-git-config file will overwrite previous settings (#819)
Expand Down
5 changes: 5 additions & 0 deletions cls/SourceControl/Git/Settings.cls
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ Property Mappings [ MultiDimensional ];
/// (user-level) List of namespaces on this instance to include Embedded Git links in the SMP favorites
Property favoriteNamespaces As %DynamicArray;

/// (Optional) Path to an SSH client configuration file for use with SSH connections to a Git remote
Property sshConfigFile As %String(MAXLEN = "") [ InitialExpression = {##class(SourceControl.Git.Utils).SSHConfigFile()} ];

Method %OnNew() As %Status
{
set mappingsNode = ##class(SourceControl.Git.Utils).MappingsNode()
Expand Down Expand Up @@ -183,6 +186,7 @@ Method %Save() As %Status
set @storage@("settings", "environmentName") = ..environmentName
set @storage@("settings", "lockBranch") = ..lockBranch
set @storage@("settings", "mappingsToken") = ..mappingsToken
set @storage@("settings", "sshConfigFile") = ..sshConfigFile
if ..basicMode = "system" {
kill @storage@("settings", "user", $username, "basicMode")
} else {
Expand Down Expand Up @@ -551,3 +555,4 @@ Method SaveDefaults() As %Boolean
}

}

14 changes: 13 additions & 1 deletion cls/SourceControl/Git/Utils.cls
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,11 @@ ClassMethod MappingsToken() As %String
quit $get(@..#Storage@("settings","mappingsToken"),"")
}

ClassMethod SSHConfigFile() As %String
{
quit $get(@..#Storage@("settings","sshConfigFile"),"")
}

ClassMethod IsLIVE() As %Boolean
{
quit ..EnvironmentName()="LIVE"
Expand Down Expand Up @@ -1896,8 +1901,14 @@ ClassMethod RunGitCommandWithInput(command As %String, inFile As %String = "", O
set privateKeyFile = $replace(privateKeyFile,"\","\\")
}
set newArgs($increment(newArgs)) = "-c"
set sshConfigFile = ..SSHConfigFile()
if sshConfigFile="" {
set sshConfigFile = "/dev/null"
} elseif $$$isWINDOWS {
set sshConfigFile = $replace(sshConfigFile,"\","\\")
}
// StrictHostKeyChecking=accept-new for good behavior on first connection
set newArgs($increment(newArgs)) = "core.sshCommand=ssh -F /dev/null -o StrictHostKeyChecking=accept-new -i "_privateKeyFile
set newArgs($increment(newArgs)) = "core.sshCommand=ssh -F "_sshConfigFile_" -o StrictHostKeyChecking=accept-new -i "_privateKeyFile
}

set username = ""
Expand Down Expand Up @@ -3320,3 +3331,4 @@ ClassMethod IsSchemaStandard(pName As %String = "") As %Boolean [ Internal ]
}

}

9 changes: 8 additions & 1 deletion csp/gitprojectsettings.csp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ body {

if ('settings.settingsUIReadOnly) {
do ##class(SourceControl.Git.Utils).Locked($get(%request.Data("lockNamespace",1)))
for param="gitBinPath","namespaceTemp","privateKeyFile","pullEventClass","percentClassReplace", "defaultMergeBranch","environmentName","mappingsToken" {
for param="gitBinPath","namespaceTemp","privateKeyFile","pullEventClass","percentClassReplace", "defaultMergeBranch","environmentName","mappingsToken","sshConfigFile" {
set $Property(settings,param) = $Get(%request.Data(param,1))
}

Expand Down Expand Up @@ -395,6 +395,13 @@ body {
}
</server>

<div class="form-group row mb-3">
<label for="sshConfigFile" class="offset-sm-1 col-sm-3 col-form-label" data-toggle="tooltip" data-placement="top" title="(Optional) Path to an SSH client configuration file for use with SSH connections to a Git remote">Path to SSH Config File</label>
<div class="col-sm-7">
<input type="text" class="form-control" id="sshConfigFile" name="sshConfigFile" value='#(..EscapeHTML(settings.sshConfigFile))#' placeholder=""/>
</div>
</div>

<div class="form-group row mb-3">
<label for="pullEventClass" class="offset-sm-1 col-sm-3 col-form-label" data-toggle="tooltip" data-placement="top" title="Handler class for git pull"><b>Pull Event Class</b></label>
<div class="col-sm-7">
Expand Down
Loading