fixes validation issue where it was honly comparing base to itself, n…#8
Merged
Conversation
…ot the staged changes
There was a problem hiding this comment.
Pull request overview
This PR fixes releasegen validate --require-changelog-entry so it correctly detects local pre-commit changes (where HEAD hasn’t advanced yet) and compares changelog content against what will actually be committed (the git index), rather than relying on the working tree / HEAD tree alone.
Changes:
- Extend VCS diffing to include worktree status in
ChangedFiles, enabling pre-commit scenarios where changes are staged but not committed. - Add
FileAtIndexand update validation to compare[Unreleased]against the staged (index) version of the changelog. - Add/extend tests covering staged-but-uncommitted changes and staged-vs-unstaged changelog behavior; document the behavior in the project changelog.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/vcs/git.go | Adds worktree-aware changed-file detection and introduces FileAtIndex for reading staged content. |
| internal/vcs/git_test.go | Adds coverage for pre-commit changed-file detection and FileAtIndex behavior across staged/unstaged/untracked cases. |
| cmd/releasegen/validate.go | Switches changelog comparison to staged/index content to match what the next commit will contain. |
| cmd/releasegen/validate_test.go | Adds regression tests for pre-commit detection and for rejecting unstaged changelog edits. |
| CHANGELOG.md | Documents the validation behavior changes (worktree-inclusive diffs and index-based changelog comparison). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
…ot the staged changes