fix(windows): derive nested worktree state from show-cdup
This commit is contained in:
@@ -98,14 +98,14 @@ function getInitGitState(cwd) {
|
|||||||
return resolved;
|
return resolved;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Most reliable signal: git reports a non-empty prefix only when cwd is
|
// Most reliable signal: git reports non-empty `--show-cdup` only when cwd is
|
||||||
// below the worktree root. This avoids short/long path alias issues on Windows.
|
// below the worktree root. This avoids short/long path alias issues on Windows.
|
||||||
let inNestedSubdir = false;
|
let inNestedSubdir = false;
|
||||||
if (info.inside) {
|
if (info.inside) {
|
||||||
try {
|
try {
|
||||||
const prefixResult = execGit(['rev-parse', '--show-prefix'], { cwd, timeout: 5000 });
|
const cdupResult = execGit(['rev-parse', '--show-cdup'], { cwd, timeout: 5000 });
|
||||||
if (prefixResult.exitCode === 0) {
|
if (cdupResult.exitCode === 0) {
|
||||||
inNestedSubdir = String(prefixResult.stdout || '').trim().length > 0;
|
inNestedSubdir = String(cdupResult.stdout || '').trim().length > 0;
|
||||||
} else {
|
} else {
|
||||||
inNestedSubdir = worktreeRoot !== null;
|
inNestedSubdir = worktreeRoot !== null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user