From ef7cde36c9994a52273ec482bf3aa703c08332e1 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Thu, 25 Oct 2018 16:06:40 +0200 Subject: [PATCH] feat: inform on whether repository was created --- lib/setup-repository.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/setup-repository.js b/lib/setup-repository.js index 6b36610..20d303b 100644 --- a/lib/setup-repository.js +++ b/lib/setup-repository.js @@ -8,7 +8,7 @@ const isObject = require("es5-ext/object/is-object") module.exports = async ({ path, meta: { repoUrl } }, options = {}) => { if (!isObject(options)) options = {}; if (await isDirectory(path)) { - if (options.skipGitUpdate) return; + if (options.skipGitUpdate) return false; // Confirm directory is clean const { stdout } = await runProgram("git", ["status", "--porcelain"], { cwd: path }); if (stdout) throw new Error(`Repository ${ path } is not clean:\n${ stdout }`); @@ -16,8 +16,9 @@ module.exports = async ({ path, meta: { repoUrl } }, options = {}) => { // Update log.info("update repository %s", path); await runProgram("git", ["pull"], { cwd: path, logger: log.levelRoot.get("git:pull") }); - return; + return false; } log.info("clone repository %s from %s", path, repoUrl); await runProgram("git", ["clone", repoUrl, path], { logger: log.levelRoot.get("git:clone") }); + return true; };