Skip to content

Fix remote branch deletion without local tracking refs - #769

Merged
iangmaia merged 1 commit into
trunkfrom
iangmaia/fix-remote-branch-deletion
Aug 13, 2026
Merged

Fix remote branch deletion without local tracking refs#769
iangmaia merged 1 commit into
trunkfrom
iangmaia/fix-remote-branch-deletion

Conversation

@iangmaia

@iangmaia iangmaia commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

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

  • Run bundle exec rubocop to test for code style violations and recommendations.
  • Add Unit Tests (aka specs/*_spec.rb) if applicable.
  • Run bundle exec rspec to run the whole test suite and ensure all your tests pass.
  • Make sure you added an entry in the CHANGELOG.md file to describe your changes under the appropriate existing ### subsection of the existing ## Trunk section.
  • If applicable, add an entry in the MIGRATION.md file to describe how the changes will affect the migration from the previous major version and what the clients will need to change and consider.

@iangmaia iangmaia self-assigned this Aug 12, 2026
@iangmaia
iangmaia force-pushed the iangmaia/fix-remote-branch-deletion branch from 525da3b to 54520a3 Compare August 12, 2026 16:36
@iangmaia iangmaia added the bug Something isn't working label Aug 12, 2026
@iangmaia
iangmaia marked this pull request as ready for review August 12, 2026 16:39
@iangmaia
iangmaia requested a review from a team as a code owner August 12, 2026 16:39
Copilot AI lite review requested due to automatic review settings August 12, 2026 16:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread spec/git_helper_spec.rb
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}`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently that option has been around since 2020. I think we'll be fine.

@mokagio mokagio left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adds test coverage for the behavior.

Always happy to see these. Thank you.

@iangmaia
iangmaia merged commit 7765dc9 into trunk Aug 13, 2026
10 of 11 checks passed
@iangmaia
iangmaia deleted the iangmaia/fix-remote-branch-deletion branch August 13, 2026 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants