Description
getUntrackedDiff filters untracked entries to detect directories that are git repos (submodules) by checking entry.endsWith('/') and running git rev-parse --verify HEAD per entry. But git ls-files --others -z (called at line 146) emits individual file paths — without --directory it never outputs a directory with a trailing slash — so the endsWith('/') branch is unreachable. The entire pathspecs filter and its per-entry execFileSync calls are dead code that runs for every unstaged-diff computation.
Note the filter also resolves cwd: resolve(entry) against the process CWD rather than the repo root, which would misbehave if the branch were ever reachable from a subdirectory.
Location
src/git/diff.ts lines 156–171
Code
const pathspecs = untrackedEntries.filter((entry) => {
if (!entry.endsWith('/')) { // never true for `ls-files --others` output
return true;
}
try {
execFileSync(getGitExecutable(), ['rev-parse', '--verify', 'HEAD'], {
cwd: resolve(entry), // also resolves against process CWD, not repo root
...
Suggested fix
Remove the submodule branch entirely (files-only output needs no filtering), or if submodule-aware behavior is intended, detect submodules properly via git submodule foreach --quiet / --others --directory and resolve paths against the repo root.
Impact
Dead code that gives a false impression of submodule handling; every unstaged-diff computation pays for filtering and potential per-entry git spawns for nothing.
Description
getUntrackedDifffilters untracked entries to detect directories that are git repos (submodules) by checkingentry.endsWith('/')and runninggit rev-parse --verify HEADper entry. Butgit ls-files --others -z(called at line 146) emits individual file paths — without--directoryit never outputs a directory with a trailing slash — so theendsWith('/')branch is unreachable. The entirepathspecsfilter and its per-entryexecFileSynccalls are dead code that runs for every unstaged-diff computation.Note the filter also resolves
cwd: resolve(entry)against the process CWD rather than the repo root, which would misbehave if the branch were ever reachable from a subdirectory.Location
src/git/diff.tslines 156–171Code
Suggested fix
Remove the submodule branch entirely (files-only output needs no filtering), or if submodule-aware behavior is intended, detect submodules properly via
git submodule foreach --quiet/--others --directoryand resolve paths against the repo root.Impact
Dead code that gives a false impression of submodule handling; every unstaged-diff computation pays for filtering and potential per-entry git spawns for nothing.