Skip to content

Commit 458d986

Browse files
committed
Add alerts when git is too old
1 parent 73284cf commit 458d986

File tree

4 files changed

+28
-1
lines changed

4 files changed

+28
-1
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
- Support for editing repo from filesystem perspective via web application (#464)
1414
- Support for downloading a VSCode workspace file from web UI
1515
- IncrementalLoad pull event handler will update the running production, if any (#473)
16+
- Warnings to users if git version is incompatible (#488)
1617

1718
### Fixed
1819
- Instance wide settings are placed in proper global (#444)

cls/SourceControl/Git/API.cls

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ ClassMethod Configure()
1717
}
1818
set gitExists = ##class(SourceControl.Git.Utils).GitBinExists(.version)
1919
set gitBinPath = ##class(SourceControl.Git.Utils).GitBinPath(.isDefault)
20+
21+
// Make sure they are using an appropriate git version
22+
if (+$PIECE(version,"version ",2))<2.31 {
23+
write !!, "WARNING: You are using an older version of git which is not compatible with git-source-control. Please upgrade to git version 2.31.0 or greater to continue"
24+
write !!, "Cancelling git-source-control configuration..."
25+
quit
26+
}
2027
if gitExists && isDefault {
2128
// Note: version starts with "git version"
2229
write !,version," is available via PATH. You may enter a path to a different version if needed."
@@ -65,4 +72,3 @@ ClassMethod BaselineExport(pCommitMessage = "", pPushToRemote = "") As %Status
6572
}
6673

6774
}
68-

cls/SourceControl/Git/WebUIDriver.cls

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ ClassMethod HandleRequest(pagePath As %String, InternalName As %String = "", Out
2020
set responseJSON = ..GetSettingsURL(%request)
2121
} elseif $extract(pagePath, 6, *) = "get-package-version"{
2222
set responseJSON = ..GetPackageVersion()
23+
} elseif $extract(pagePath, 6, *) = "git-version" {
24+
set responseJSON = ..GetGitVersion()
2325
} else {
2426
set %response.Status = ##class(%CSP.REST).#HTTP404NOTFOUND
2527
set responseJSON = {"error":("invalid URI: " _ pagePath)}
@@ -331,4 +333,11 @@ ClassMethod GetPackageVersion() As %Library.DynamicObject
331333
quit {"version": (version)}
332334
}
333335

336+
ClassMethod GetGitVersion() As %Library.DynamicObject
337+
{
338+
set gitExists = ##class(SourceControl.Git.Utils).GitBinExists(.version)
339+
set version = +$PIECE(version,"version ",2)
340+
quit {"version": (version)}
341+
}
342+
334343
}

git-webui/src/share/git-webui/webui/js/git-webui.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,15 @@ webui.showWarning = function(message) {
110110
'</div>').appendTo(messageBox);
111111
}
112112

113+
webui.gitVersion = function() {
114+
$.get("api/git-version", function(version) {
115+
var ver = JSON.parse(version)["version"];
116+
if (ver < 2.31) {
117+
alert("Your git version is incompatible with git-source-control. Please upgrade to git 2.31.0 or greater.")
118+
}
119+
})
120+
}
121+
113122
webui.git_command = function(command, callback) {
114123
$.ajax({
115124
url: "git-command",
@@ -313,6 +322,7 @@ webui.getNodeIndex = function(element) {
313322

314323
webui.TabBox = function(buttons) {
315324

325+
316326
var self = this;
317327

318328
self.itemClicked = function(event) {
@@ -2808,6 +2818,7 @@ webui.NewChangedFilesView = function(workspaceView) {
28082818
function MainUi() {
28092819

28102820
var self = this;
2821+
webui.gitVersion();
28112822

28122823
self.switchTo = function(element) {
28132824
webui.detachChildren(self.mainView);

0 commit comments

Comments
 (0)