Check if working directory is a git repo itself before getting commit hash

This commit is contained in:
Jérémie Astori 2018-04-16 16:08:30 +02:00
parent 3cf4e2105e
commit 2006902b8a
No known key found for this signature in database
GPG Key ID: B9A4F245CD67BDE8

View File

@ -62,6 +62,11 @@ function getGitCommit() {
return _gitCommit; return _gitCommit;
} }
if (!fs.existsSync(path.resolve(__dirname, "..", ".git", "HEAD"))) {
_gitCommit = null;
return null;
}
try { try {
_gitCommit = require("child_process") _gitCommit = require("child_process")
.execSync( .execSync(