Repository navigation
fix(gitread): answer a diff with a type change - #784
Conversation
A diff with a type change (a file that becomes a symlink or a submodule, or back) answered 500: "diff --patch has 2 file headers, want 1". --raw and --numstat give a type change one record, and --patch splits it into a deletion and an addition. mergePatches now counts two sections for a T entry, and that file's patch holds both. Found by the #780 root verifier. Change-Id: Ic78a86450eba7f54279165c199c07090341f1df0 Signed-off-by: Thomas Kosiewski <tk@coder.com>
|
@codex review |
|
@codex security review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
Why
A diff with a type change answers 500 on main: "diff --patch has 2 file headers, want 1". A type change is a file that becomes a symlink or a submodule, or a symlink or submodule that becomes a file (git's status
T). git gives it one--rawrecord and one--numstatrecord, but--patchsplits it into a deletion and an addition, twodiff --gitsections.mergePatcheswanted one section per file. #780's root verifier found it onrepos/diffandbranches/diff.What changes
mergePatchescounts two--patchsections for aTentry, and that file'sPatchholds both, its deletion then its addition. Every other file keeps its own section.Verification
TestDiffTypeChange(gitread): a commit turnstypefileinto a symlink andfiletosubinto a submodule, and changeskeep. Both directions give three entries: twoTentries with 1 addition and 1 deletion each, whose patch is the deletion (deleted file mode ...) then the addition (new file mode ...), andkeepasMwith its own one section. The patches apply (git apply --cached --check). On main both directions fail with "diff --patch has 5 file headers, want 3".TestDiffTypeChange(api, PostgreSQL and SQLite):repos/diffby commit ids andbranches/diff, to the symlink and submodule and back again, answer 200 withtypefileandfiletosubasT: 4 bytes (the symlink targetkeep, no trailing newline) and 0 bytes (a submodule), and back, 4 bytes each with a trailing newline. On main they answer 500.-race: build, vet (alsoGOOS=darwin go vetofinternal/apiandinternal/gitread), golangci-lint (0 issues), the doc-link check and both--fingerprints-onlychecks pass.internal/gitread/...passes, andinternal/apiandcmd/openstoragepass on PostgreSQL (-tags=openstorage_viewcheck), SQLite and S3-WAL.Size
191 changed lines: 27 of production Go, 163 of tests and 1 of docs.
Generated with
xum• Model:anthropic:claude-opus-5-5• Thinking:xhigh