fix: include untracked new files in uncommitted/unstaged code review diffs#227
Merged
backnotprop merged 1 commit intobacknotprop:mainfrom Mar 5, 2026
Merged
Conversation
Previously, `git diff HEAD` and `git diff` only show changes to already-tracked files. Newly created files that haven't been staged with `git add` were invisible to the code review UI, causing the reported issue where new files created by the agent simply didn't appear in the review interface. Add `getUntrackedFileDiffs()` which: 1. Lists untracked files via `git ls-files --others --exclude-standard` (respects .gitignore, so node_modules and dist dirs are excluded) 2. Generates a proper unified diff for each via `git diff --no-index` Append these diffs to the tracked-file diff in both the "uncommitted" and "unstaged" modes, which are the two views that should represent the full working-tree state. Fixes backnotprop#189 Co-Authored-By: Claude <noreply@anthropic.com>
Owner
|
Nice! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #189
Newly created files (untracked by git) were missing from the
plannotator-reviewUI becausegit diff HEADandgit diffonly output changes for files that are already tracked. Any file created by the agent but not yet staged withgit addwas invisible to the code review interface.Root Cause
In
packages/server/git.ts, therunGitDiff()function uses:git diff HEADfor the uncommitted viewgit difffor the unstaged viewBoth commands silently omit untracked files.
Fix
Add a
getUntrackedFileDiffs()helper that:git ls-files --others --exclude-standard(respects
.gitignore, sonode_modules,dist, etc. are excluded automatically)git diff --no-index --src-prefix=a/ --dst-prefix=b/ /dev/null <file>The resulting diffs are appended to the tracked-file diff in both the uncommitted and unstaged modes. The staged / last-commit / branch modes are not affected (they work correctly as-is).
Changes
packages/server/git.ts— addgetUntrackedFileDiffs()helper; updateuncommittedandunstagedcases inrunGitDiff()to include its output (+47/-4 lines)🤖 Generated with Claude Code