diff --git a/CHANGELOG.md b/CHANGELOG.md index 46dcc89a..fcbfbb5a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added saving settings as system default for new namespaces (#535) - Added filtering through branch names in UI (#615) - FullLoad pull event handler allows deploying changes with a full import of the repository (#619) +- Pull and Sync options no longer log a fatal error if remote branch does not exist (#562) ## [2.7.1] - 2024-11-13 diff --git a/cls/SourceControl/Git/Utils.cls b/cls/SourceControl/Git/Utils.cls index aafa49c4..3760af50 100644 --- a/cls/SourceControl/Git/Utils.cls +++ b/cls/SourceControl/Git/Utils.cls @@ -634,10 +634,15 @@ ClassMethod Pull(remote As %String = "origin", pTerminateOnError As %Boolean = 0 New %gitSCOutputFlag Set %gitSCOutputFlag = 1 #define Force 1 - do ##class(SourceControl.Git.Utils).RunGitCommandWithInput("branch",,.errStream,.outStream,"--show-current") - set branchName = outStream.ReadLine(outStream.Size) + set branchName = ..GetCurrentBranch() write !, "Pulling from branch: ", branchName kill errStream, outStream + do ##class(SourceControl.Git.Utils).RunGitCommandWithInput("ls-remote",,.errStream, .outStream, remote, branchName) + if (outStream.Read() = "") { + write !, "Skipping pull because remote branch does not exist." + quit $$$OK + } + kill errStream, outStream set returnCode = ..RunGitWithArgs(.errStream, .outStream, "pull", remote, branchName) write ! do outStream.OutputToDevice()