Skip to content

Commit

Permalink
Merge pull request #492 from intersystems/git-version-reminder
Browse files Browse the repository at this point in the history
Add alerts when git is too old
  • Loading branch information
isc-tleavitt authored Sep 24, 2024
2 parents 72663dc + 946822b commit 2feb15c
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.5.1] - Unreleased

### Fixed
- Added warnings when user is using incompatible git version (#488)

## [2.5.0] - 2024-09-24

### Added
Expand Down
8 changes: 7 additions & 1 deletion cls/SourceControl/Git/API.cls
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ ClassMethod Configure()
}
set gitExists = ##class(SourceControl.Git.Utils).GitBinExists(.version)
set gitBinPath = ##class(SourceControl.Git.Utils).GitBinPath(.isDefault)

// Make sure they are using an appropriate git version
if (+$PIECE(version,"version ",2))<2.31 {
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"
write !!, "Cancelling git-source-control configuration..."
quit
}
if gitExists && isDefault {
// Note: version starts with "git version"
write !,version," is available via PATH. You may enter a path to a different version if needed."
Expand Down Expand Up @@ -65,4 +72,3 @@ ClassMethod BaselineExport(pCommitMessage = "", pPushToRemote = "") As %Status
}

}

9 changes: 9 additions & 0 deletions cls/SourceControl/Git/WebUIDriver.cls
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ ClassMethod HandleRequest(pagePath As %String, InternalName As %String = "", Out
set responseJSON = ..GetSettingsURL(%request)
} elseif $extract(pagePath, 6, *) = "get-package-version"{
set responseJSON = ..GetPackageVersion()
} elseif $extract(pagePath, 6, *) = "git-version" {
set responseJSON = ..GetGitVersion()
} else {
set %response.Status = ##class(%CSP.REST).#HTTP404NOTFOUND
set responseJSON = {"error":("invalid URI: " _ pagePath)}
Expand Down Expand Up @@ -331,4 +333,11 @@ ClassMethod GetPackageVersion() As %Library.DynamicObject
quit {"version": (version)}
}

ClassMethod GetGitVersion() As %Library.DynamicObject
{
set gitExists = ##class(SourceControl.Git.Utils).GitBinExists(.version)
set version = +$PIECE(version,"version ",2)
quit {"version": (version)}
}

}
11 changes: 11 additions & 0 deletions git-webui/release/share/git-webui/webui/js/git-webui.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,15 @@ webui.showWarning = function(message) {
'</div>').appendTo(messageBox);
}

webui.gitVersion = function() {
$.get("api/git-version", function(version) {
var ver = JSON.parse(version)["version"];
if (ver < 2.31) {
alert("Your git version is incompatible with git-source-control. Please upgrade to git 2.31.0 or greater.")
}
})
}

webui.git_command = function(command, callback) {
$.ajax({
url: "git-command",
Expand Down Expand Up @@ -313,6 +322,7 @@ webui.getNodeIndex = function(element) {

webui.TabBox = function(buttons) {


var self = this;

self.itemClicked = function(event) {
Expand Down Expand Up @@ -2808,6 +2818,7 @@ webui.NewChangedFilesView = function(workspaceView) {
function MainUi() {

var self = this;
webui.gitVersion();

self.switchTo = function(element) {
webui.detachChildren(self.mainView);
Expand Down
11 changes: 11 additions & 0 deletions git-webui/src/share/git-webui/webui/js/git-webui.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,15 @@ webui.showWarning = function(message) {
'</div>').appendTo(messageBox);
}

webui.gitVersion = function() {
$.get("api/git-version", function(version) {
var ver = JSON.parse(version)["version"];
if (ver < 2.31) {
alert("Your git version is incompatible with git-source-control. Please upgrade to git 2.31.0 or greater.")
}
})
}

webui.git_command = function(command, callback) {
$.ajax({
url: "git-command",
Expand Down Expand Up @@ -313,6 +322,7 @@ webui.getNodeIndex = function(element) {

webui.TabBox = function(buttons) {


var self = this;

self.itemClicked = function(event) {
Expand Down Expand Up @@ -2808,6 +2818,7 @@ webui.NewChangedFilesView = function(workspaceView) {
function MainUi() {

var self = this;
webui.gitVersion();

self.switchTo = function(element) {
webui.detachChildren(self.mainView);
Expand Down
2 changes: 1 addition & 1 deletion module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Document name="git-source-control.ZPM">
<Module>
<Name>git-source-control</Name>
<Version>2.5.0</Version>
<Version>2.5.1</Version>
<Description>Server-side source control extension for use of Git on InterSystems platforms</Description>
<Keywords>git source control studio vscode</Keywords>
<Packaging>module</Packaging>
Expand Down

0 comments on commit 2feb15c

Please sign in to comment.