Skip to content

Commit 34c3e29

Browse files
committed
addressed issues with invalid pull request
1 parent 785cc83 commit 34c3e29

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

cls/SourceControl/Git/API.cls

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,4 @@ ClassMethod BaselineExport(pCommitMessage = "", pPushToRemote = "") As %Status
6565
}
6666

6767
}
68+

cls/SourceControl/Git/Utils.cls

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -446,9 +446,10 @@ ClassMethod Pull(remote As %String = "origin") As %Status
446446
set branchName = outStream.ReadLine(outStream.Size)
447447
write !, "Pulling from branch: ", branchName
448448

449-
set sc = ..RunGitWithArgs(.errStream, .outStream, "pull", remote _ "/" _ branchName)
449+
set returnCode = ..RunGitWithArgs(.errStream, .outStream, "pull", remote _ "/" _ branchName)
450450

451-
quit sc
451+
w !, "Pull ran with return code: " _ returnCode
452+
quit $$$OK
452453
}
453454

454455
ClassMethod Clone(remote As %String) As %Status
@@ -1504,7 +1505,10 @@ ClassMethod RunGitCommand(command As %String, Output errStream, Output outStream
15041505

15051506
ClassMethod RunGitCommandWithInput(command As %String, inFile As %String = "", Output errStream, Output outStream, args...) As %Integer
15061507
{
1507-
1508+
set pullArg = ""
1509+
if command = "pull" {
1510+
set pullArg = args(1)
1511+
}
15081512
// Special case: git --version is used internally even when the settings incorporated here may be invalid/unspecified.
15091513
if (command '= "--version") {
15101514
set newArgs($increment(newArgs)) = "-C"
@@ -1536,6 +1540,7 @@ ClassMethod RunGitCommandWithInput(command As %String, inFile As %String = "", O
15361540
set syncIris = 0
15371541
set diffBase = ""
15381542
set diffCompare = ""
1543+
set pullOriginIndex = ""
15391544
if (command = "checkout") || (command = "merge") || (command = "rebase") || (command = "pull"){
15401545
set syncIris = 1
15411546
set diffCompare = args(args)
@@ -1545,6 +1550,9 @@ ClassMethod RunGitCommandWithInput(command As %String, inFile As %String = "", O
15451550
for i=1:1:$get(args) {
15461551
if ($data(args(i))) {
15471552
set newArgs($increment(newArgs)) = args(i)
1553+
if newArgs(newArgs) = pullArg {
1554+
set pullOriginIndex = newArgs
1555+
}
15481556
if (args(i) = "checkout") || (args(i) = "merge") || (args(i) = "rebase") || (args(i) = "pull"){
15491557
set syncIris = 1
15501558
set diffCompare = args(i + 1)
@@ -1553,6 +1561,10 @@ ClassMethod RunGitCommandWithInput(command As %String, inFile As %String = "", O
15531561
set diffBase = args(i + 2)
15541562
}
15551563
}
1564+
1565+
if (args(i) = "pull") {
1566+
set pullOriginIndex = i
1567+
}
15561568
}
15571569
}
15581570

@@ -1583,6 +1595,10 @@ ClassMethod RunGitCommandWithInput(command As %String, inFile As %String = "", O
15831595
set mod = files(files)
15841596
write !, ?4, modification.changeType, ?4, modification.internalName, ?4 , modification.externalName
15851597
}
1598+
1599+
if pullOriginIndex '= "" {
1600+
set newArgs(pullOriginIndex) = $piece(newArgs(pullOriginIndex), "/", 1)
1601+
}
15861602
}
15871603

15881604
set outLog = ##class(%Library.File).TempFilename()

0 commit comments

Comments
 (0)