From df4beef0607f0a31cc9a73ba5adbf4b976c33e40 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Fri, 2 Feb 2018 11:37:18 +0000 Subject: [PATCH] Check version of git client on startup --- red/runtime/locales/en-US/runtime.json | 2 +- .../storage/localfilesystem/projects/git/index.js | 3 ++- red/runtime/storage/localfilesystem/projects/index.js | 9 ++++++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/red/runtime/locales/en-US/runtime.json b/red/runtime/locales/en-US/runtime.json index d2435b482..93d5de2c9 100644 --- a/red/runtime/locales/en-US/runtime.json +++ b/red/runtime/locales/en-US/runtime.json @@ -148,7 +148,7 @@ "disabled": "Projects disabled : editorTheme.projects.enabled=false", "disabledNoFlag": "Projects disabled : set editorTheme.projects.enabled=true to enable", "git-not-found": "Projects disabled : git command not found", - "git-version-old": "Projects disabled : git __version__ too old" + "git-version-old": "Projects disabled : git __version__ not supported. Requires 2.x" } } } diff --git a/red/runtime/storage/localfilesystem/projects/git/index.js b/red/runtime/storage/localfilesystem/projects/git/index.js index 451b11e95..67e830427 100644 --- a/red/runtime/storage/localfilesystem/projects/git/index.js +++ b/red/runtime/storage/localfilesystem/projects/git/index.js @@ -393,9 +393,10 @@ module.exports = { email: globalUserEmail } } + log.trace("git init: "+JSON.stringify(result)); resolve(result); }).catch(function(err) { - console.log(err); + log.trace("git init: git not found"); resolve(null); }); }); diff --git a/red/runtime/storage/localfilesystem/projects/index.js b/red/runtime/storage/localfilesystem/projects/index.js index 3499de90b..53a46a067 100644 --- a/red/runtime/storage/localfilesystem/projects/index.js +++ b/red/runtime/storage/localfilesystem/projects/index.js @@ -46,7 +46,6 @@ function init(_settings, _runtime) { try { if (settings.editorTheme.projects.enabled === true) { - projectLogMessages.push(log._("storage.localfilesystem.projects.disabled")) projectsEnabled = true; } else if (settings.editorTheme.projects.enabled === false) { projectLogMessages.push(log._("storage.localfilesystem.projects.disabled")) @@ -92,8 +91,12 @@ function init(_settings, _runtime) { if (projectsEnabled) { return sshTools.init(settings,runtime).then(function() { gitTools.init(_settings, _runtime).then(function(gitConfig) { - if (!gitConfig) { - projectLogMessages.push(log._("storage.localfilesystem.projects.git-not-found")) + if (!gitConfig || /^1\./.test(gitConfig.version)) { + if (!gitConfig) { + projectLogMessages.push(log._("storage.localfilesystem.projects.git-not-found")) + } else { + projectLogMessages.push(log._("storage.localfilesystem.projects.git-version-old",{version:gitConfig.version})) + } projectsEnabled = false; try { // As projects have to be turned on, we know this property