Handle + force-push prefix in git push branch completion#232
Merged
Conversation
Add push_refspec_branches and push_refspec_tags generators that detect the + force-push prefix in git push refspec arguments and prepend it to completion suggestions. This allows the completer's prefix matcher to correctly match branches when the user types 'git push origin +<branch>'. The generators use command_from_tokens to detect the + prefix in the current token, output a marker line before the branch/tag listing when present, and the post-processing callbacks strip the marker and prepend + to all suggestions. Fixes APP-3488 Co-Authored-By: Oz <oz-agent@warp.dev>
APP-3488 [git] Handle + prefix in git push origin +<branch>
See GitHub #5225 |
+ force-push prefix in git push branch completion
Contributor
Author
Generator Validation ScreenshotsTested the Test 1:
|
Contributor
Author
vkodithala
approved these changes
Apr 3, 2026
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.


Summary
Handle the
+force-push prefix ingit push origin +<branch>branch name completion.Previously, typing
git push origin +fo<TAB>would not show any completions because the+prefix was included in the token matched against branch names, and no branch starts with+.Changes
Generator changes (
git.rs)push_refspec_branchesandpush_refspec_tagsgenerators usingcommand_from_tokens+prefix in the current token and use a marker-based approach to signal the post-processing callback to prepend+to all suggestionswith_force_prefix_detection(),strip_force_prefix(),prepend_to_suggestions()Spec changes (
git.json)pushsubcommand's refspec arg from["local_branches", "tags"]to["push_refspec_branches", "push_refspec_tags"]Tests
Screenshots
Force-push completion (
git push origin +test<TAB>)Normal completion for comparison (
git push origin test<TAB>)Fixes
APP-3488
Conversation: https://staging.warp.dev/conversation/d2fec893-5962-43c5-befc-be9f7988e851
Run: https://oz.staging.warp.dev/runs/019d4b04-f397-72bf-9e4b-4afe4776ff6e
This PR was generated with Oz.