Skip to content

Commit 18e5fc3

Browse files
authored
Merge pull request #59 from duizendnegen/feature/fix-non-git
Handle non-git projects by resolving promise with empty object
2 parents 457f19a + 7d8be83 commit 18e5fc3

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

lib/scm-data-generators/git.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,19 @@ module.exports = CoreObject.extend({
1414
return new RSVP.Promise(function(resolve/*, reject */) {
1515
simpleGit(_this.path).log(function(err, log) {
1616
var info = log.latest;
17-
resolve({
18-
sha: info.hash.replace("'",''),
19-
email: info.author_email.replace("'",''),
20-
name: info.author_name,
21-
timestamp: new Date(info.date).toISOString(),
22-
branch: gitRepoInfo().branch,
23-
tag: gitRepoInfo().tag
24-
});
17+
18+
if(!info) {
19+
resolve();
20+
} else {
21+
resolve({
22+
sha: info.hash.replace("'",''),
23+
email: info.author_email.replace("'",''),
24+
name: info.author_name,
25+
timestamp: new Date(info.date).toISOString(),
26+
branch: gitRepoInfo().branch,
27+
tag: gitRepoInfo().tag
28+
});
29+
}
2530
});
2631
});
2732
}

0 commit comments

Comments
 (0)