fix: move branch validation after --paths-only exit#2481
Open
mnriem wants to merge 1 commit into
Open
Conversation
check-prerequisites.sh and check-prerequisites.ps1 ran branch validation before the --paths-only early exit, causing --paths-only to fail on non-feature branches despite documentation stating 'no validation'. Move check_feature_branch / Test-FeatureBranch after the paths-only block so callers that only need path variables are not subject to branch-name checks. Fixes github#2477
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes an inconsistency between documentation and behavior in the consolidated prerequisite scripts: --paths-only / -PathsOnly is documented as “no validation”, but branch-name validation was still being executed before the early exit, causing unexpected failures on non-feature branches.
Changes:
- Move branch-name validation to occur after the
--paths-only/-PathsOnlyearly-exit block in the Bash script. - Apply the same ordering change in the PowerShell script to keep behavior consistent across shells.
Show a summary per file
| File | Description |
|---|---|
| scripts/bash/check-prerequisites.sh | Moves check_feature_branch after the --paths-only early exit so paths-only mode truly skips branch validation. |
| scripts/powershell/check-prerequisites.ps1 | Moves Test-FeatureBranch after the -PathsOnly early exit for parity with the Bash script. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 1
Comment on lines
+114
to
+116
| # Validate branch name | ||
| check_feature_branch "$CURRENT_BRANCH" "$HAS_GIT" || exit 1 | ||
|
|
Collaborator
Author
|
@copilot apply changes based on the comments in this thread |
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.
check-prerequisites.sh and check-prerequisites.ps1 ran branch validation before the --paths-only early exit, causing --paths-only to fail on non-feature branches despite documentation stating 'no validation'.
Move check_feature_branch / Test-FeatureBranch after the paths-only block so callers that only need path variables are not subject to branch-name checks.
Fixes #2477