Repository navigation
fix(git): limit comparisons by literal pathspecs - #242
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Note
Newer findings are available below. Devin Review posted a newer report on this PR, in addition to the findings presented here.
Devin Review found 1 finding. Devin automatically fixed it.
Fixed by Devin (1)
- Scoped comparisons fail in bare repositories — Fixed by detecting bare repositories before resolving a worktree root; scoped two-reference comparisons now run in the bare repository, with regression coverage for
HEAD~1..HEADlimited toz-target.txt.
There was a problem hiding this comment.
Note
Newer findings are available below. Devin Review posted a newer report on this PR, in addition to the findings presented here.
Devin Review found 1 finding. Devin's session did not pick them up; it is left for you to triage below.
| "diff".to_string(), | ||
| "--name-status".to_string(), | ||
| "--find-renames".to_string(), | ||
| "-z".to_string(), |
There was a problem hiding this comment.
🟡 Comparison loses distinct filenames
When tracked filenames contain invalid UTF-8, comparison_diff receives replacement characters from into_command_response. Distinct files can get the same reported path, and includeUntracked then drops one change during deduplication.
Learn more
Git accepts Unix filenames that are not valid UTF-8. In its default name-status output, Git quotes and escapes invalid bytes, preserving the distinction between filenames. The -z output instead sends raw filename bytes. into_command_response replaces invalid bytes before the comparison parser sees them. comparison then uses these altered paths as map keys when includeUntracked is true.
Example: Modify two tracked files named report- followed by byte 0xFE and byte 0xFF, respectively. A whole-repository comparison reports both as report-�. With includeUntracked: true, it reports only one change at that path.
Recommended fix: Parse NUL-delimited comparison output from raw bytes. Preserve invalid filename bytes with a reversible representation, or return an explicit decoding error when a path cannot be represented in the JSON response. Do not deduplicate on a lossy UTF-8 conversion.
Was this helpful? React with 👍 or 👎 to provide feedback.
Summary
pathspecstogit.comparison, preserving whole-repository behavior when omitted.--name-statusoutput and untracked worktree entries, including Git-compatible normalization of./ empty path components../file, subdirectory-root, and bare-repository cases withrust/fixtures/git/comparison-pathspecs-v1.jsonplus regression tests.Validation:
GIT_EDITOR=true cargo test --manifest-path rust/Cargo.toml -p lithe-core git_comparison_pathspecs_limit_tracked_and_untracked_files -- --nocapturecargo clippy --manifest-path rust/Cargo.toml -p lithe-git -p lithe-core --all-targets -- -D warningsscripts/rust-core/verify-rust-core-comments.shGIT_EDITOR=true cargo test --manifest-path rust/Cargo.toml -p lithe-git -p lithe-core,node scripts/rust-core/affected-crates.mjs,node scripts/rust-core/verify-platform-tests.mjs --list, andnode --test scripts/rust-core/*.test.mjsPart of 1lck/Lithe-IDEA#2550. The branch is merged with current Core
mainso the desktop host can pin one commit without dropping newer Core baseline changes.Link to Devin session: https://app.devin.ai/sessions/40fd0cdabd664dafadc0c1783ea1cb59
Open in Devin Desktop: https://app.devin.ai/desktop/session/40fd0cdabd664dafadc0c1783ea1cb59?variant=devin
Requested by: @1lck
🟢 Devin Review found nothing to fix · View findings · Follow Devin's work