Skip to content

Handle + force-push prefix in git push branch completion#232

Merged
lucieleblanc merged 4 commits into
mainfrom
app-3488/command-spec-git-push-force-prefix
Apr 6, 2026
Merged

Handle + force-push prefix in git push branch completion#232
lucieleblanc merged 4 commits into
mainfrom
app-3488/command-spec-git-push-force-prefix

Conversation

@lucieleblanc
Copy link
Copy Markdown
Contributor

Summary

Handle the + force-push prefix in git 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)

  • Added push_refspec_branches and push_refspec_tags generators using command_from_tokens
  • These detect the + prefix in the current token and use a marker-based approach to signal the post-processing callback to prepend + to all suggestions
  • Helper functions: with_force_prefix_detection(), strip_force_prefix(), prepend_to_suggestions()

Spec changes (git.json)

  • Changed the push subcommand's refspec arg from ["local_branches", "tags"] to ["push_refspec_branches", "push_refspec_tags"]

Tests

  • Added 4 tests covering branches and tags with and without the force prefix

Screenshots

Force-push completion (git push origin +test<TAB>)

Force-push completion

Normal completion for comparison (git push origin test<TAB>)

Normal completion

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.

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>
@linear
Copy link
Copy Markdown

linear Bot commented Apr 1, 2026

APP-3488 [git] Handle + prefix in git push origin +<branch>

git push origin +fo<TAB> — the + prefix (force-push syntax) breaks branch name completion. The completer/parser doesn't strip the + prefix before matching against branch generators.

See GitHub #5225

@lucieleblanc lucieleblanc changed the title Handle + force-push prefix in git push branch completion Handle + force-push prefix in git push branch completion Apr 3, 2026
Copy link
Copy Markdown
Contributor Author

lucieleblanc commented Apr 3, 2026

Generator Validation Screenshots

Tested the push_refspec_branches and push_refspec_tags generators locally by patching warp-internal to use the local command-signatures checkout on this branch.

Test 1: git push origin <Tab> (without + prefix)

Shows branches and tags as normal completions (master, bugfix/auth-error, feature/dashboard, feature/login, v1.0.0, v2.0.0).

Test 2: git push origin +<Tab> (with + force-push prefix)

Shows branches and tags with + prefix for force-push (+master, +bugfix/auth-error, +feature/dashboard, +feature/login, +v1.0.0, +v2.0.0).

Both generators work correctly ✅

@lucieleblanc
Copy link
Copy Markdown
Contributor Author

Manually attaching screenshots:
image
image

@lucieleblanc lucieleblanc marked this pull request as ready for review April 3, 2026 21:02
@lucieleblanc lucieleblanc merged commit 10729ed into main Apr 6, 2026
3 checks passed
@lucieleblanc lucieleblanc deleted the app-3488/command-spec-git-push-force-prefix branch April 6, 2026 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants