Skip to content

feat: add -diff flag to restrict mutations to changed lines#26

Merged
fchimpan merged 4 commits into
mainfrom
feat/diff-mode
Mar 27, 2026
Merged

feat: add -diff flag to restrict mutations to changed lines#26
fchimpan merged 4 commits into
mainfrom
feat/diff-mode

Conversation

@fchimpan

Copy link
Copy Markdown
Owner

Summary

  • Add -diff <git-ref> flag that filters mutation points to only lines changed relative to the given ref, using git diff --unified=0 <ref>...HEAD
  • New diff/ package with git diff parsing and mutation point filtering, with comprehensive unit tests (15 test cases)
  • Add mutest CI job that runs mutation testing on pull requests with -diff origin/main -threshold 100
  • Document diff mode usage in README

Test plan

  • go test ./... -race passes
  • go vet ./... passes
  • Manual verification: go run . -diff HEAD~1 -dry-run ./... correctly filters to changed lines only
  • Manual verification: go run . -diff HEAD~1 ./... runs and reports results for changed lines only

Add a -diff flag that accepts a git ref (e.g., origin/main) and filters
mutation points to only lines changed relative to that ref. This makes
mutest practical for CI pipelines where a global kill-rate threshold is
hard to set — instead, enforce that new/changed code is well-tested.

Internally uses `git diff --unified=0 <ref>...HEAD -- '*.go'` to
identify changed lines, then filters the discovered mutation points
by file path and line number.
@fchimpan fchimpan merged commit 15344bb into main Mar 27, 2026
2 checks 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.

1 participant