diff --git a/CHANGELOG.md b/CHANGELOG.md index 6199922..57ef024 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/cls/SourceControl/Git/API.cls b/cls/SourceControl/Git/API.cls index 0e10964..3b1fa4e 100644 --- a/cls/SourceControl/Git/API.cls +++ b/cls/SourceControl/Git/API.cls @@ -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." @@ -65,4 +72,3 @@ ClassMethod BaselineExport(pCommitMessage = "", pPushToRemote = "") As %Status } } - diff --git a/cls/SourceControl/Git/WebUIDriver.cls b/cls/SourceControl/Git/WebUIDriver.cls index d558044..5aead7a 100644 --- a/cls/SourceControl/Git/WebUIDriver.cls +++ b/cls/SourceControl/Git/WebUIDriver.cls @@ -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)} @@ -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)} +} + } diff --git a/git-webui/release/share/git-webui/webui/js/git-webui.js b/git-webui/release/share/git-webui/webui/js/git-webui.js index b0834fa..49006e1 100644 --- a/git-webui/release/share/git-webui/webui/js/git-webui.js +++ b/git-webui/release/share/git-webui/webui/js/git-webui.js @@ -110,6 +110,15 @@ webui.showWarning = function(message) { '').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", @@ -313,6 +322,7 @@ webui.getNodeIndex = function(element) { webui.TabBox = function(buttons) { + var self = this; self.itemClicked = function(event) { @@ -2808,6 +2818,7 @@ webui.NewChangedFilesView = function(workspaceView) { function MainUi() { var self = this; + webui.gitVersion(); self.switchTo = function(element) { webui.detachChildren(self.mainView); diff --git a/git-webui/src/share/git-webui/webui/js/git-webui.js b/git-webui/src/share/git-webui/webui/js/git-webui.js index b0834fa..49006e1 100644 --- a/git-webui/src/share/git-webui/webui/js/git-webui.js +++ b/git-webui/src/share/git-webui/webui/js/git-webui.js @@ -110,6 +110,15 @@ webui.showWarning = function(message) { '').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", @@ -313,6 +322,7 @@ webui.getNodeIndex = function(element) { webui.TabBox = function(buttons) { + var self = this; self.itemClicked = function(event) { @@ -2808,6 +2818,7 @@ webui.NewChangedFilesView = function(workspaceView) { function MainUi() { var self = this; + webui.gitVersion(); self.switchTo = function(element) { webui.detachChildren(self.mainView); diff --git a/module.xml b/module.xml index fd8f8b2..9374fb5 100644 --- a/module.xml +++ b/module.xml @@ -3,7 +3,7 @@ git-source-control - 2.5.0 + 2.5.1 Server-side source control extension for use of Git on InterSystems platforms git source control studio vscode module