From 42b4c4f96c3b8b352e4bfa62270edcc9183d07c0 Mon Sep 17 00:00:00 2001 From: JohannesHoppe Date: Tue, 17 May 2016 18:56:30 +0200 Subject: [PATCH] fix(): skips git-init if working folder is inside a git repo avoids a nested git repo, which is probably not what we wanted to have --- addon/ng2/tasks/git-init.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/addon/ng2/tasks/git-init.js b/addon/ng2/tasks/git-init.js index 57094373227d..afb53a630bd7 100644 --- a/addon/ng2/tasks/git-init.js +++ b/addon/ng2/tasks/git-init.js @@ -30,6 +30,19 @@ module.exports = Task.extend({ return exec('git --version') .then(function () { + // check if we're inside a git repo + return exec('git rev-parse --is-inside-work-tree') + .then(function () { + return true; + }) + .catch(function() { + return false; + }) + }) + .then(function (insideGitRepo) { + if (insideGitRepo) { + return ui.writeLine('Directory is already under version control. Skipping initialization of git.'); + } return exec('git init') .then(function () { return exec('git add .');