Skip to content

Commit c1ca545

Browse files
committed
feat: skip pull if remote branch does not exist instead of logging fatal error
1 parent 5a852bd commit c1ca545

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313
- Added saving settings as system default for new namespaces (#535)
1414
- Added filtering through branch names in UI (#615)
1515
- FullLoad pull event handler allows deploying changes with a full import of the repository (#619)
16+
- Pull and Sync options no longer log a fatal error if remote branch does not exist (#562)
1617

1718
## [2.7.1] - 2024-11-13
1819

cls/SourceControl/Git/Utils.cls

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -634,10 +634,15 @@ ClassMethod Pull(remote As %String = "origin", pTerminateOnError As %Boolean = 0
634634
New %gitSCOutputFlag
635635
Set %gitSCOutputFlag = 1
636636
#define Force 1
637-
do ##class(SourceControl.Git.Utils).RunGitCommandWithInput("branch",,.errStream,.outStream,"--show-current")
638-
set branchName = outStream.ReadLine(outStream.Size)
637+
set branchName = ..GetCurrentBranch()
639638
write !, "Pulling from branch: ", branchName
640639
kill errStream, outStream
640+
do ##class(SourceControl.Git.Utils).RunGitCommandWithInput("ls-remote",,.errStream, .outStream, remote, branchName)
641+
if (outStream.Read() = "") {
642+
write !, "Skipping pull because remote branch does not exist."
643+
quit $$$OK
644+
}
645+
kill errStream, outStream
641646
set returnCode = ..RunGitWithArgs(.errStream, .outStream, "pull", remote, branchName)
642647
write !
643648
do outStream.OutputToDevice()

0 commit comments

Comments
 (0)