Skip to content

Commit

Permalink
fix(): skips git-init if working folder is inside a git repo
Browse files Browse the repository at this point in the history
avoids a nested git repo, which is probably not what we wanted to have

Closes #802
  • Loading branch information
JohannesHoppe authored and hansl committed May 20, 2016
1 parent ad0d874 commit 52c0cfb
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions addon/ng2/tasks/git-init.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 .');
Expand Down

0 comments on commit 52c0cfb

Please sign in to comment.