1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Check version of git client on startup

This commit is contained in:
Nick O'Leary 2018-02-02 11:37:18 +00:00
parent a52f195d41
commit df4beef060
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
3 changed files with 9 additions and 5 deletions

View File

@ -148,7 +148,7 @@
"disabled": "Projects disabled : editorTheme.projects.enabled=false", "disabled": "Projects disabled : editorTheme.projects.enabled=false",
"disabledNoFlag": "Projects disabled : set editorTheme.projects.enabled=true to enable", "disabledNoFlag": "Projects disabled : set editorTheme.projects.enabled=true to enable",
"git-not-found": "Projects disabled : git command not found", "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"
} }
} }
} }

View File

@ -393,9 +393,10 @@ module.exports = {
email: globalUserEmail email: globalUserEmail
} }
} }
log.trace("git init: "+JSON.stringify(result));
resolve(result); resolve(result);
}).catch(function(err) { }).catch(function(err) {
console.log(err); log.trace("git init: git not found");
resolve(null); resolve(null);
}); });
}); });

View File

@ -46,7 +46,6 @@ function init(_settings, _runtime) {
try { try {
if (settings.editorTheme.projects.enabled === true) { if (settings.editorTheme.projects.enabled === true) {
projectLogMessages.push(log._("storage.localfilesystem.projects.disabled"))
projectsEnabled = true; projectsEnabled = true;
} else if (settings.editorTheme.projects.enabled === false) { } else if (settings.editorTheme.projects.enabled === false) {
projectLogMessages.push(log._("storage.localfilesystem.projects.disabled")) projectLogMessages.push(log._("storage.localfilesystem.projects.disabled"))
@ -92,8 +91,12 @@ function init(_settings, _runtime) {
if (projectsEnabled) { if (projectsEnabled) {
return sshTools.init(settings,runtime).then(function() { return sshTools.init(settings,runtime).then(function() {
gitTools.init(_settings, _runtime).then(function(gitConfig) { gitTools.init(_settings, _runtime).then(function(gitConfig) {
if (!gitConfig) { if (!gitConfig || /^1\./.test(gitConfig.version)) {
projectLogMessages.push(log._("storage.localfilesystem.projects.git-not-found")) 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; projectsEnabled = false;
try { try {
// As projects have to be turned on, we know this property // As projects have to be turned on, we know this property