Skip to content

Commit 2feb15c

Browse files
authored
Merge pull request #492 from intersystems/git-version-reminder
Add alerts when git is too old
2 parents 72663dc + 946822b commit 2feb15c

File tree

6 files changed

+44
-2
lines changed

6 files changed

+44
-2
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [2.5.1] - Unreleased
9+
10+
### Fixed
11+
- Added warnings when user is using incompatible git version (#488)
12+
813
## [2.5.0] - 2024-09-24
914

1015
### Added

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/release/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);

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);

module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<Document name="git-source-control.ZPM">
44
<Module>
55
<Name>git-source-control</Name>
6-
<Version>2.5.0</Version>
6+
<Version>2.5.1</Version>
77
<Description>Server-side source control extension for use of Git on InterSystems platforms</Description>
88
<Keywords>git source control studio vscode</Keywords>
99
<Packaging>module</Packaging>

0 commit comments

Comments
 (0)