Repository navigation
fix: keep selected archive commits from including neighboring files - #259
Merged
Merged
Conversation
vincentkoc
marked this pull request as ready for review
November 19, 2026 13:07
|
🦞👀 Pull request received. I will update this pull request when review starts. |
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.
What Problem This Solves
Committing a selected archive file named
notes[1].mdalso commitsnotes1.md: Git interprets the brackets as a pattern. An unrelated file can enter the archive even when it was staged separately.User Impact
Scoped mirror commits now include only the selected files or directories, and leave unrelated staged files staged. Explicit selections no longer expand Git glob patterns or pathspec magic; callers that want the whole archive can continue using
.. Existing whitespace trimming and repository-relative checks remain unchanged.Why This Change Was Made
Use Git's literal-path mode consistently when staging, checking for changes, and committing. All three operations must agree on the selected paths.
Evidence
Before the fix, selecting the bracketed filename committed its neighbor, including when that neighbor was already staged. Regression tests now pass for bracketed file and directory selections with untracked and pre-staged neighbors, checking the committed tree, remaining index, and a repeated unchanged selection.
Local library validation passed. Independent native review found no P0–P3 issues. The local downstream
CommitPathscaller found in slacrawl uses..Validation details
GOWORK=off go test -count=1 ./mirror -run '^TestCommitPaths'GOWORK=off go mod tidygit diff --exit-code -- go.mod go.sumGOWORK=off go vet ./...GOWORK=off go test -count=1 ./...git diff --check774d9188ae5652a2c2c3797f66d012046422a456379b579ac150eddc36159fc8e2a5d2f385d98b97