Skip to content

fix: keep selected archive commits from including neighboring files - #259

Merged
vincentkoc merged 1 commit into
mainfrom
fix/mirror-literal-commits
Nov 19, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
fix/mirror-literal-commits

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

What Problem This Solves

Committing a selected archive file named notes[1].md also commits notes1.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 CommitPaths caller found in slacrawl uses ..

Validation details
  • GOWORK=off go test -count=1 ./mirror -run '^TestCommitPaths'
  • GOWORK=off go mod tidy
  • git diff --exit-code -- go.mod go.sum
  • GOWORK=off go vet ./...
  • GOWORK=off go test -count=1 ./...
  • git diff --check
  • The final unchanged-selection assertion was added after the broad suite; the focused suite was rerun afterward.
  • Reviewed candidate: 774d9188ae5652a2c2c3797f66d012046422a456
  • Base: 379b579ac150eddc36159fc8e2a5d2f385d98b97

@vincentkoc
vincentkoc marked this pull request as ready for review November 19, 2026 13:07
@clawsweeper

clawsweeper Bot commented Nov 19, 2026

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@vincentkoc
vincentkoc merged commit 5ceb548 into main Nov 19, 2026
8 checks passed
@vincentkoc
vincentkoc deleted the fix/mirror-literal-commits branch November 19, 2026 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant