Skip to content

Commit 52c0cfb

Browse files
JohannesHoppehansl
authored andcommitted
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 Closes #802
1 parent ad0d874 commit 52c0cfb

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

addon/ng2/tasks/git-init.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,19 @@ module.exports = Task.extend({
3030

3131
return exec('git --version')
3232
.then(function () {
33+
// check if we're inside a git repo
34+
return exec('git rev-parse --is-inside-work-tree')
35+
.then(function () {
36+
return true;
37+
})
38+
.catch(function() {
39+
return false;
40+
})
41+
})
42+
.then(function (insideGitRepo) {
43+
if (insideGitRepo) {
44+
return ui.writeLine('Directory is already under version control. Skipping initialization of git.');
45+
}
3346
return exec('git init')
3447
.then(function () {
3548
return exec('git add .');

0 commit comments

Comments
 (0)