Skip to content

fix(#17): dedupe rsync --exclude emissions after **/ normalization - #20

Merged
eloualiche merged 1 commit into
mainfrom
fix/17-dedupe-excludes
Apr 16, 2026
Merged

fix(#17): dedupe rsync --exclude emissions after **/ normalization#20
eloualiche merged 1 commit into
mainfrom
fix/17-dedupe-excludes

Conversation

@eloualiche

Copy link
Copy Markdown
Member

Summary

  • Factor the two `--exclude=` emission loops in `Syncer.BuildCommand()` into a new `appendExcludes` helper that dedupes on the normalized (post-`strings.TrimPrefix("**/")`) pattern.
  • Pre-existing quirk: `ignore = [".venv/", "**/.venv/"]` (a common defensive double-form) produced two identical `--exclude=.venv/` args. rsync silently ignored the duplicate so there is no correctness bug, but `--verbose` output was noisy.
  • TDD: two new tests that fail on `main` and pass after the fix, covering both the `include`-set and no-`include` branches of `BuildCommand`.

Closes #17.

Test plan

  • New `TestBuildCommand_DedupExcludes` and `TestBuildCommand_DedupExcludes_WithInclude` pass
  • Existing `TestBuildCommand_ExcludePatterns`, `TestBuildCommand_IncludePatterns`, `TestBuildCommand_ExcludesBeforeIncludes` still green
  • `go test ./...` green locally; CI to confirm

Users often write both .venv/ and **/.venv/ defensively in the
ignore list. Both normalize to .venv/ after TrimPrefix, and the
old code emitted --exclude=.venv/ twice. rsync silently tolerates
duplicates, but the doubled flags noise up --verbose output.

Factor both emission loops in BuildCommand into appendExcludes(),
which tracks cleaned patterns in a map and skips repeats.
@eloualiche
eloualiche merged commit f67860b into main Apr 16, 2026
1 check passed
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.

Dedupe duplicate --exclude emissions when ignore has both anchored and **/-prefixed forms

1 participant