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",
"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"
}
}
}

View File

@ -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);
});
});

View File

@ -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