• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

umputun / revdiff / 28422375943

30 Jun 2026 05:25AM UTC coverage: 89.807% (-0.1%) from 89.934%
28422375943

push

github

web-flow
fix: detect renames when the new file is untracked (#246)

* fix: detect renames when the new file is untracked

a plain `mv old new` (no `git mv`/staging) left `old` as an unstaged
deletion and `new` untracked, so `git diff -M` never paired them - the
tree showed a deletion plus an all-+ add instead of one rename.

`UntrackedRenames` recovers the pairing off a throwaway index: copy
`.git/index`, `git add -N` the untracked paths against the copy via
`GIT_INDEX_FILE`, then `git diff -M` reports the rename. The real index
and working tree are never touched. `FileDiff` renders these the same
way via `untrackedRenameDiff`. Git-only (hg/jj have no untracked-rename
concept), gated to unstaged working-tree mode.

Related to #243

* fix(test): clear AGTERM env so launcher exit-code test stays hermetic

`cleanOverlayEnv` cleared every overlay-detection var except the agterm
ones. On an agterm host `AGTERM_SESSION_ID` leaked from the real
environment, so the launcher took its agterm branch (real `agtermctl
session overlay open`) instead of the fake backend under test. That path
doesn't pipe the fake revdiff's stdout/exit back, so every non-clean
case returned exit 0 / empty output, while the "clean" case passed by
coincidence. CI stayed green because CI isn't an agterm session.

now clear `AGTERM_SESSION_ID` and `AGTERM_SOCKET` too. The agterm overlay
backend (#238) added the launcher branch but left this helper out of sync.

* fix(review-loop): iteration 1 addressed 8 findings

- [major] [annotations_load.go] --annotations preload now runs the untracked-rename detector (foldUntrackedRenames) so (-)/context annotations on an untracked rename round-trip instead of being dropped as all-added
- [major] [diff.go] untracked-rename git calls use GIT_LITERAL_PATHSPECS=1 (renameIndexEnv) so a filename like ":(top)x" is treated literally, not as pathspec magic
- [minor] [diff.go] temp index path made absolute (filepath.Abs) so GIT_INDEX_FILE and cleanup agree when TMPDI... (continued)

153 of 225 new or added lines in 6 files covered. (68.0%)

10494 of 11685 relevant lines covered (89.81%)

3063.45 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

91.98
/app/diff/diff.go


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc