@bobfrankston/npmglobalize 1.0.168 → 1.0.169
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib.js +12 -3
- package/package.json +1 -1
package/lib.js
CHANGED
|
@@ -2042,9 +2042,18 @@ export function getGitStatus(cwd) {
|
|
|
2042
2042
|
remoteBranch: '',
|
|
2043
2043
|
isBehindRemote: false
|
|
2044
2044
|
};
|
|
2045
|
-
// Check if git repo
|
|
2046
|
-
|
|
2047
|
-
|
|
2045
|
+
// Check if git repo — walk up the directory tree to find the enclosing
|
|
2046
|
+
// .git, like git itself does. Previously this only looked for `.git/` at
|
|
2047
|
+
// cwd, which broke for any subdir inside a repo (e.g., a workspace
|
|
2048
|
+
// member that lives inside a parent monorepo's git tree).
|
|
2049
|
+
let gitDir;
|
|
2050
|
+
try {
|
|
2051
|
+
const result = execSync('git rev-parse --git-dir', { cwd, encoding: 'utf-8', stdio: ['pipe', 'pipe', 'ignore'] }).trim();
|
|
2052
|
+
if (!result)
|
|
2053
|
+
return status;
|
|
2054
|
+
gitDir = path.isAbsolute(result) ? result : path.resolve(cwd, result);
|
|
2055
|
+
}
|
|
2056
|
+
catch {
|
|
2048
2057
|
return status;
|
|
2049
2058
|
}
|
|
2050
2059
|
status.isRepo = true;
|