From 0d18266ad19495d020678119d5160adb87dfb9e6 Mon Sep 17 00:00:00 2001 From: Chris van Marle Date: Tue, 6 Dec 2016 19:57:38 +0100 Subject: [PATCH] Fetch remote git only if repo has a remote --- modules/default/updatenotification/node_helper.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/modules/default/updatenotification/node_helper.js b/modules/default/updatenotification/node_helper.js index 6147c061..b8e58a7d 100644 --- a/modules/default/updatenotification/node_helper.js +++ b/modules/default/updatenotification/node_helper.js @@ -29,7 +29,18 @@ module.exports = NodeHelper.create({ continue; } - simpleGits.push({"module": moduleName, "git": SimpleGit(moduleFolder)}); + var res = function(mn, mf) { + var git = SimpleGit(mf); + git.getRemotes(true, function(err, remotes) { + if (remotes.length < 1 || remotes[0].name.length < 1) { + // No valid remote for folder, skip + return; + } + + // Folder has .git and has at least one git remote, watch this folder + simpleGits.push({"module": mn, "git": git}); + }); + }(moduleName, moduleFolder); } }