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
9 changes: 5 additions & 4 deletions cls/SourceControl/Git/Utils.cls
Original file line number Diff line number Diff line change
Expand Up @@ -3020,17 +3020,18 @@ ClassMethod BaselineExport(pCommitMessage = "", pPushToRemote = "") As %Status
}

/// Returns the url for the "origin" remote repository
ClassMethod GetConfiguredRemote(Output remoteExists As %Boolean = 0) As %String
ClassMethod GetConfiguredRemote(Output remoteExists As %Boolean = 0, Output sc As %Status = {$$$OK}) As %String
{
set exitCode = ..RunGitCommand("remote",.err,.out,"get-url","origin")
if (exitCode = 0) {
set remoteExists = 1
set url = out.ReadLine()
} elseif (exitCode = 2) {
} else {
set remoteExists = 0
set url = ""
} else {
$$$ThrowStatus($$$ERROR($$$GeneralError,"git reported failure"))
if '$listfind($listbuild(2,3),exitCode) {
set sc = $$$ERROR($$$GeneralError,"git reported failure")
}
}
return url
}
Expand Down
13 changes: 8 additions & 5 deletions csp/gitprojectsettings.csp
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,6 @@ body {
set settings.mappedItemsReadOnly = 0
}

set newRemote = $Get(%request.Data("remoteRepo",1))
// If entry was modified, set new remote repo
if (newRemote '= ##class(SourceControl.Git.Utils).GetRedactedRemote()) {
do ##class(SourceControl.Git.Utils).SetConfiguredRemote(newRemote)
}

set settings.compileOnImport = ($Get(%request.Data("compileOnImport", 1)) = 1)
set settings.decomposeProductions = ($Get(%request.Data("decomposeProductions", 1)) = 1)
Expand Down Expand Up @@ -188,6 +183,14 @@ body {
kill buffer
throw err
}
set newRemote = $Get(%request.Data("remoteRepo",1))
// If entry was modified and git repo is initialized, set new remote repo
set dir = ##class(%File).NormalizeDirectory(settings.namespaceTemp)
if (settings.namespaceTemp '= "") && ##class(%File).DirectoryExists(dir_".git") {
if (newRemote '= ##class(SourceControl.Git.Utils).GetRedactedRemote()) {
do ##class(SourceControl.Git.Utils).SetConfiguredRemote(newRemote)
}
}
set successfullySavedSettings = 1
}
set remote = ##class(SourceControl.Git.Utils).GetRedactedRemote()
Expand Down
Loading