Skip to content
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

Add alerts when git is too old #492

Merged
merged 4 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Support for editing repo from filesystem perspective via web application (#464)
- Support for downloading a VSCode workspace file from web UI
- IncrementalLoad pull event handler will update the running production, if any (#473)
- Warnings to users if git version is incompatible (#488)

### Fixed
- Instance wide settings are placed in proper global (#444)
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/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
Loading