prezto
prezto copied to clipboard
`git push -d origin bran<TAB>` autocomplete suggests `origin/branch` instead of `branch`
Description
If I want to delete branch
which exists on a remote origin
, and I type git push -d origin bran...
and press Tab, autocomplete suggests origin/branch
.
Expected behavior
Autocomplete should suggest branch
.
Actual behavior
Autocomplete suggests origin/branch
. If branch
does not exist locally, pressing Enter fails with a confusing error:
error: unable to delete 'origin/branch': remote ref does not exist
error: failed to push some refs to 'https://github.com/jimbo1qaz/...git'
Steps to Reproduce
- Install prezto, enable git plugin, and cd to a local Git repo.
- Create a branch which exists only remotely. (a. push local branch, then delete local branch) (create PR through github's web-based file editor)
- Locally,
git fetch
-
git push -d origin bran...
and press Tab.
Versions
- Prezto commit: 5d7c990
- ZSH version: zsh 5.4.2 (x86_64-ubuntu-linux-gnu)
- OS information: Ubuntu 18.04 x64
@nyanpasu64: Is it still the case, I do not observe the same behaviour. Could you give information about you shell and git?
Yup, that happen to me too.
Try it with prezto repo.
git clone https://github.com/sorin-ionescu/prezto.git
cd prezto
git push -d origin bel<TAB>
latest prezto, git v2.27.0.rc0
I have since switched to fish, which seems to have the exact same bug in its default configuration (not 100% sure though).
@diraol did try it out and the bel<TAB>
expands to origin/bel...
, but isn't that the expected behaviour? There's no local branch starting with the prefix bel
, so the completion system tries to complete to a remote ref of origin/bel..
.
The proper syntax to delete origin/branch
(both locally and on the origin
remote) is git push -d origin branch
, not origin/branch
.
@nyanpasu64 not contesting the syntax of deletion. I'm contesting the semantics of the completion engine which has to figure out the completion. After typing origin, it needs a local branch which does not exist. When you type bel<TAB>
it can only complete to a remote HEAD as no local HEAD exists with that prefix. This is how completion on TAB looks without a prefix:
This seems like the correct behaviour to me, but I can be wrong.
it should only suggest remote branches existing on origin
, but omit the origin/
prefix.
(sorry for double post via FastHub app)