Repository navigation
refactor(git): share one branch push for the fast-forward and force cases - #1286
Merged
Merged
Conversation
BryanFRD
enabled auto-merge (squash)
October 6, 2026 06:49
Contributor
There was a problem hiding this comment.
This refactor doesn't change behaviour. For both modes, the refspec (+ only for force), the retry label, the spawn and failure messages, and the error codes (GIT_PUSH_BRANCH / GIT_FORCE_PUSH_BRANCH) all match the two removed functions. force_push_branch still validates refnames before pushing, and nothing else referenced try_push_branch or try_force_push_branch_once. is_push_rejected_error and is_transient_git_error read message text, and the text they see is unchanged, so retry and regenerate classification stays the same. No findings.
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.
Closes #1284
try_push_branch_onceandtry_force_push_branch_oncewere the same 25 lines, the duplicated block Sonar reports insrc/git/push.rs. They now sharepush_branch_once, driven by aBranchPushmode (FastForward,Force) that supplies the+refspec prefix, the verb, the spawned command for the context and the error code (E2004 / E2012).No behaviour change: the refspecs, retry labels, messages and codes are the same as before, and
force_push_branchkeeps its refname validation. Covered by the existing push and release-PR tests.