Fix remote branch deletion without local tracking refs - #769
Merged
Conversation
iangmaia
force-pushed
the
iangmaia/fix-remote-branch-deletion
branch
from
August 12, 2026 16:36
525da3b to
54520a3
Compare
iangmaia
marked this pull request as ready for review
August 12, 2026 16:39
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves GitHelper.delete_remote_branch_if_exists! so it can delete a remote branch even when the local checkout lacks the corresponding remote-tracking ref (e.g., narrow-fetch CI environments), and adds regression coverage for that behavior.
Changes:
- Update
delete_remote_branch_if_exists!to verify branch existence directly on the remote before attempting deletion. - Add an RSpec case covering deletion when no local remote-tracking ref exists.
- Add a CHANGELOG entry documenting the behavior change.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
lib/fastlane/plugin/wpmreleasetoolkit/helper/git_helper.rb |
Switches remote-branch existence check to a remote query to support narrow-fetch checkouts. |
spec/git_helper_spec.rb |
Adds a regression spec ensuring remote deletion works without a local remote-tracking ref. |
CHANGELOG.md |
Documents the bug fix under ## Trunk → ### Bug Fixes. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| add_file_and_commit(file: 'file.txt', message: 'Initial commit') | ||
|
|
||
| remote_path = File.join(@path, 'remote.git') | ||
| `git init --bare --initial-branch main #{remote_path}` |
Contributor
There was a problem hiding this comment.
Apparently that option has been around since 2020. I think we'll be fine.
mokagio
approved these changes
Aug 13, 2026
mokagio
left a comment
Contributor
There was a problem hiding this comment.
Adds test coverage for the behavior.
Always happy to see these. Thank you.
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.
What does it do?
Makes
delete_remote_branch_if_exists!check the actual remote before deleting, so it works in narrow-fetch CI checkouts without a local remote-tracking ref.Adds test coverage for the behavior.
Checklist before requesting a review
bundle exec rubocopto test for code style violations and recommendations.specs/*_spec.rb) if applicable.bundle exec rspecto run the whole test suite and ensure all your tests pass.CHANGELOG.mdfile to describe your changes under the appropriate existing###subsection of the existing## Trunksection.MIGRATION.mdfile to describe how the changes will affect the migration from the previous major version and what the clients will need to change and consider.