Skip to content

feat(sggit): add optional pathspecs to VerifyNoDiff#783

Draft
CervEdin wants to merge 1 commit intomasterfrom
feat/sggit-verify-no-diff-pathspecs
Draft

feat(sggit): add optional pathspecs to VerifyNoDiff#783
CervEdin wants to merge 1 commit intomasterfrom
feat/sggit-verify-no-diff-pathspecs

Conversation

@CervEdin
Copy link
Copy Markdown

Summary

  • Add variadic pathspecs ...string parameter to VerifyNoDiff, allowing callers to scope the diff check to specific files (e.g. "*.md", ":(exclude)vendor")
  • Pathspecs are passed after a -- separator to avoid being interpreted as flags
  • Fully backwards-compatible: no pathspecs = current whole-tree behavior
  • Adds tests covering clean repo, dirty repo, glob pathspecs, and :(exclude) pathspecs

Motivation

Repos that use VerifyNoDiff after FormatMarkdown currently fail when unrelated files (e.g. regenerated Makefiles) have diffs. Scoping to "*.md" lets the check focus on what FormatMarkdown actually touches.

Test plan

  • go test ./tools/sggit/... — all 4 new tests pass
  • go vet ./tools/sggit/... — clean
  • Verify existing callers (no args) still work as before

🤖 Generated with Claude Code

Allow scoping the diff check to specific files by passing git
pathspecs (e.g. "*.md", ":(exclude)vendor"). Pathspecs are passed
after a "--" separator. When no pathspecs are given the entire
working tree is checked, preserving backwards compatibility.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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