From 424c0413fbcb070d084f63b33912621dbe947ce4 Mon Sep 17 00:00:00 2001 From: tarzak Date: Wed, 25 Jun 2014 16:42:48 +0300 Subject: [PATCH] feature(update) add git check Add check of `.git` directory before running `git pull`. --- lib/server/update.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/server/update.js b/lib/server/update.js index 74c4e8ef..c65456bf 100644 --- a/lib/server/update.js +++ b/lib/server/update.js @@ -18,8 +18,13 @@ Util = main.util, DIR = main.DIR; - exports.get = function(){ - exec('git pull --rebase', {cwd : DIR}, pull); + exports.get = function() { + fs.readdir(DIR, function(err, list) { + var isGit = list.indexOf('.git') >= 0; + + if (!err && isGit) + exec('git pull --rebase', {cwd : DIR}, pull); + }); }; /**