From 1c08b6dce6812a7514014cefd65195bc9b048b35 Mon Sep 17 00:00:00 2001 From: Reto Brunner Date: Fri, 3 Dec 2021 18:14:26 +0100 Subject: [PATCH] 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. --- src/helper.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/helper.js b/src/helper.js index be106721..58316b97 100644 --- a/src/helper.js +++ b/src/helper.js @@ -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; }