Skip to content

Commit

Permalink
feat: inform on whether repository was created
Browse files Browse the repository at this point in the history
  • Loading branch information
medikoo committed Oct 25, 2018
1 parent 0343807 commit 0602ab5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/setup-repository.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@ 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 }`);

// 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;
};

0 comments on commit 0602ab5

Please sign in to comment.