Skip to content

Commit 8d41e1c

Browse files
authored
Merge pull request intersystems#364 from intersystems/fix-recent-bugs
Fix recent bugs
2 parents 3ce71a0 + 5925807 commit 8d41e1c

File tree

4 files changed

+33
-15
lines changed

4 files changed

+33
-15
lines changed

cls/SourceControl/Git/Change.cls

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -126,29 +126,39 @@ ClassMethod RefreshUncommitted(Display = 0, IncludeRevert = 0, Output gitFiles,
126126
do ##class(Utils).GitStatus(.gitFiles)
127127

128128
// Remove entries in the uncommitted queue that don't correspond to changes as tracked by git
129-
set filename="", filename=$order(tFileList(filename),1,action)
130-
while (filename'="") {
131-
set examine=$select(action="add":1,action="edit":1,action="delete":1, IncludeRevert&&(action="revert"):1,1:0)
132-
if 'examine set filename=$order(tFileList(filename),1,action) continue
129+
set filename=""
130+
for {
131+
set filename=$order(tFileList(filename),1,action)
132+
quit:filename=""
133+
134+
set examine=$select(action="add":1,
135+
action="edit":1,
136+
action="delete":1,
137+
IncludeRevert&&(action="revert"):1,
138+
1:0)
139+
if 'examine {
140+
continue
141+
}
133142

134143
set packageRoot = ##class(SourceControl.Git.Utils).TempFolder()
135144
set InternalName = ##class(SourceControl.Git.Utils).NameToInternalName(filename,0,0)
136145

137146
// skip files belonging to other git enabled packages
138147
if ($EXTRACT(filename, 1, $LENGTH(packageRoot)) '= packageRoot) continue
139-
140148

141149
if (('##class(%File).Exists(filename)) || (InternalName = "") || ((InternalName '= "") && ('$data(gitFiles(InternalName), found)) &&
142150
(($data($$$TrackedItems(InternalName))) || ##class(SourceControl.Git.Utils).NormalizeExtension($data($$$TrackedItems(InternalName)))))) {
143151
set sc=..RemoveUncommitted(filename,Display,0,0)
144-
if $$$ISERR(sc) set filename="" continue
152+
if $$$ISERR(sc) continue
145153
}
146-
set filename=$order(tFileList(filename),1,action)
147154
}
148155

149156
// Add missing records to the uncommitted queue that correspond to changes as tracked by git
150-
set filename="", filename=$order(gitFiles(filename),1,details)
151-
while (filename'="") {
157+
set filename=""
158+
for {
159+
set filename=$order(gitFiles(filename),1,details)
160+
quit:filename=""
161+
152162
set InternalName = filename
153163
set ExternalName = ##class(%File).NormalizeFilename(##class(SourceControl.Git.Utils).TempFolder()_$list(details,2))
154164
set changeType = $list(details,1)
@@ -161,9 +171,8 @@ ClassMethod RefreshUncommitted(Display = 0, IncludeRevert = 0, Output gitFiles,
161171

162172
if ((##class(%File).Exists(ExternalName)) && ('$ISVALIDNUM(InternalName)) && ('..IsUncommitted(ExternalName)) && ($data($$$TrackedItems(InternalName)))) {
163173
set sc=..SetUncommitted(ExternalName, action, InternalName, $USERNAME, "", 1, "", "", 0)
164-
if $$$ISERR(sc) w sc set filename="" continue
174+
if $$$ISERR(sc) continue
165175
}
166-
set filename=$order(gitFiles(filename),1,details)
167176
}
168177
set ^IRIS.Temp.gitsourcecontrol("Refresh") = $zdatetime($ztimestamp,-2)
169178
merge ^IRIS.Temp.gitsourcecontrol("LastUncommitted") = gitFiles

cls/SourceControl/Git/File.cls

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,4 @@ Storage Default
6969
}
7070

7171
}
72+

cls/SourceControl/Git/PullEventHandler/IncrementalLoad.cls

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,4 @@ Method DeleteFile(item As %String)
5151
}
5252

5353
}
54+

cls/SourceControl/Git/Utils.cls

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,8 @@ ClassMethod Fetch(ByRef diffFiles) As %Status
432432
quit $$$OK
433433
}
434434

435-
ClassMethod GetCurrentBranch() As %String{
435+
ClassMethod GetCurrentBranch() As %String
436+
{
436437
do ##class(SourceControl.Git.Utils).RunGitCommandWithInput("branch",,.errStream,.outStream,"--show-current")
437438
set branchName = outStream.ReadLine(outStream.Size)
438439
quit branchName
@@ -2075,9 +2076,14 @@ ClassMethod CheckInitialization()
20752076

20762077
ClassMethod GetPackageVersion() As %String
20772078
{
2078-
do ##class(%ZPM.PackageManager).GetVersion("git-source-control",.out)
2079-
set scVersion = out("git-source-control")
2080-
quit $LIST(scVersion, 2)
2079+
set package = $$$NULLOREF
2080+
if $$$comClassDefined("%IPM.Storage.Module") {
2081+
set package = ##class(%IPM.Storage.Module).NameOpen("git-source-control")
2082+
} elseif $$$comClassDefined("%ZPM.PackageManager.Developer.Module") {
2083+
set package = ##class(%ZPM.PackageManager.Developer.Module).NameOpen("git-source-control")
2084+
}
2085+
quit $select($IsObject(package):package.VersionString,
2086+
1:"unknown")
20812087
}
20822088

20832089
ClassMethod GetSourceControlInclude() As %String
@@ -2276,3 +2282,4 @@ ClassMethod BaselineExport(pCommitMessage = "", pPushToRemote = "") As %Status
22762282
}
22772283

22782284
}
2285+

0 commit comments

Comments
 (0)