fix: prevent squash on out-of-sync branches#579
fix: prevent squash on out-of-sync branches#579Brookke wants to merge 3 commits intoaviator-co:masterfrom
Conversation
Add validation to ensure branches are in sync with their parent before allowing squash operations. This prevents data loss when parent branches have been force-pushed or modified externally. - Add validateBranchSync function with dual validation checks - Update squash command to validate sync before proceeding - Add comprehensive tests for sync validation scenarios
Current Aviator status
This pull request is currently open (not queued). How to mergeTo merge this PR, comment
See the real-time status of this PR on the
Aviator webapp.
Use the Aviator Chrome Extension
to see the status of your PR within GitHub.
|
🔃 FlexReview StatusCommon Owner:
Review SLO: |
| // Only enforces this check for non-trunk branches when we have a stored parent head. | ||
| // This validation prevents commands from operating on branches that are out of sync | ||
| // with their parent, which could lead to unexpected behavior or loss of commits. | ||
| func validateBranchSync(ctx context.Context, repo *git.Repo, branch meta.Branch) error { |
There was a problem hiding this comment.
Not sure the philosophy around how much this CLI should act as a wizard. I.e. rather than throwing an error maybe the cli should prompt for "do you want to run av sync?".
Happy to update depending on what you prefer
|
/aviator refresh |
Aviator status snapshotThis pull request is currently open (not queued). How to mergeTo merge this PR, comment You can also comment |
Summary
Changes
validateBranchSyncfunction with dual validation checks (parent head movement and merge base verification)