Skip to content

fix(extraction): detect untracked files inside untracked directories (#1213)#1215

Open
maxmilian wants to merge 1 commit into
colbymchenry:mainfrom
maxmilian:fix/1213-sync-untracked-uall
Open

fix(extraction): detect untracked files inside untracked directories (#1213)#1215
maxmilian wants to merge 1 commit into
colbymchenry:mainfrom
maxmilian:fix/1213-sync-untracked-uall

Conversation

@maxmilian

Copy link
Copy Markdown
Contributor

Summary

Fixes #1213. codegraph sync silently skipped source files that live inside an untracked directory, reporting "Already up to date" and never picking them up (the file watcher missed them too).

Root cause

git status --porcelain --no-renames collapses an entirely-untracked directory into a single ?? frontend/ entry instead of listing the files inside it. collectGitStatus (src/extraction/index.ts) treats such ?? dir/ entries as possible embedded git repos and recurses via findNestedGitRepos — which only returns directories that are themselves git repos. A plain untracked directory has none, so its source files are never added to changes.added.

(The reporter's diagnosis was against v1.3.0, where the entry was simply skipped; on main the untracked-dir handling now exists but only covers embedded repos, so the same files still slip through.)

Fix

Add -uall so git lists individual untracked files (?? frontend/app.js) rather than collapsing the directory. Verified that nested untracked git repos still collapse to ?? repo/ even with -uall — git never crosses a repo boundary — so the existing embedded-repo recursion is unaffected.

One-line behavior change; root-cause analysis and the -uall fix were suggested by the reporter in #1213.

Tests

getGitChangedFiles is exported and covered by two regression tests:

  • source files inside a fully-untracked directory are detected (the bug);
  • an untracked embedded git repo is still recursed into (guards against an -uall regression).

Both pass; tsc --noEmit is clean; the existing sync / multi-repo-workspace / worktree-detection suites remain green.

…olbymchenry#1213)

git status --porcelain collapses an entirely-untracked directory into a
single '?? dir/' entry. collectGitStatus only recurses into such dirs to
find embedded git repos, so source files in a plain untracked directory
were never surfaced to sync — 'codegraph sync' reported 'Already up to
date' and the watcher missed them too.

Add -uall so git lists individual untracked files. Nested untracked git
repos still collapse to '?? repo/' even with -uall (git never crosses a
repo boundary), so the embedded-repo recursion is unaffected.

Export getGitChangedFiles and add regression tests for both the plain
untracked-directory case and the embedded-repo recursion (no -uall
regression).

Root-cause analysis and fix suggested by the reporter in colbymchenry#1213.
@maxmilian maxmilian marked this pull request as ready for review July 8, 2026 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

codegraph sync silently skips all untracked files

1 participant