Skip to content

Add alerts when git is too old #492

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading