Repository navigation
fix(diff): decide binary diffs by the diff attribute, as git diff does (ADR 0033) - #16
Merged
Merged
Conversation
…s (ADR 0033) Commit diffs and untracked files judged binary by a NUL byte alone, so files .gitattributes marks -diff or binary were counted and diffed as text.
git diff between commits ignores the index's .gitattributes; loading it also cost about 300 ms per request in a 700k-entry repository.
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.
Commit diffs and untracked files were judged binary by a NUL byte alone, so a file that
.gitattributesmarks-difforbinarywas counted and diffed as text, whilegit diffshows- -. They now follow thediffattribute first, as ADR 0033 records. Tracked uncommitted files already matched git, because they go through the git CLI.Where the attributes come from
git diff <commit> <commit>reads the working tree's.gitattributes,info/attributesand the global files, but neither the index nor the compared commits.DiffAttributes::ofhands gix an empty index to get the same result. Editing.gitattributesin the working tree therefore changes how past commits show, as it does in git.The empty index also keeps the cost flat. Loading a 700k-entry index took about 300 ms, and the detail, diff and commit-diff requests each build this lookup.
Where it still differs from git
The ADR lists the remaining gaps: textconv is not run, untracked files over 4 MiB stay binary, and a rename is judged by its new path only. The file list still shows a binary file as
+0 −0, which the ROADMAP now tracks.