getGitCommit: allow git worktrees

Change the short circuit logic to only test for a .git path.
With worktrees that's just a file, not a directory and we really
shouldn't play git anyhow and not rely on implementation details.
This commit is contained in:
Reto Brunner 2021-12-03 18:14:26 +01:00
parent 304d207820
commit 1c08b6dce6

View File

@ -73,7 +73,7 @@ function getGitCommit() {
return _gitCommit;
}
if (!fs.existsSync(path.resolve(__dirname, "..", ".git", "HEAD"))) {
if (!fs.existsSync(path.resolve(__dirname, "..", ".git"))) {
_gitCommit = null;
return null;
}