Skip to content

completion: fix bugs with slashes in remote names

David Mandelberg via GitGitGadget git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 20 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3completion: add helper to escape strings for fnmatchcontrib/completion/git-completion.bash t/t9902-completion.sh+19 -00 replies
2/3completion: add helper to count path componentscontrib/completion/git-completion.bash t/t9902-completion.sh+37 -00 replies
3/3completion: fix bugs with slashes in remote namescontrib/completion/git-completion.bash t/t9902-completion.sh+169 -2820 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] completion: fix bugs with slashes in remote names

Previously, some calls to for-each-ref passed fixed numbers of path components to strip from refs, assuming that remote names had no slashes in them. This made completions like:

git push github/dseomn :com

Result in:

git push github/dseomn :dseomn/completion-remote-slash

With this patch, it instead results in:

git push github/dseomn :completion-remote-slash

In addition, the change to __git_dwim_remote_heads() restricts it to only list remote branches, not HEAD. I think that actually improves the completion where it's used though, since HEAD doesn't seem to be valid anyway:

$ git switch HEAD fatal: a branch is expected, got 'HEAD'

David Mandelberg (3):
completion: add helper to escape strings for fnmatch
completion: add helper to count path components
completion: fix bugs with slashes in remote names

 contrib/completion/git-completion.bash |  40 ++++-
 t/t9902-completion.sh                  | 213 ++++++++++++++++++++++---
 2 files changed, 225 insertions(+), 28 deletions(-)

base-commit: cb0ae672aeabefca9704477ea8018ac94f523970
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1901%2Fdseomn%2Fcompletion-remote-slash-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1901/dseomn/completion-remote-slash-v1
Pull-Request: https://github.com/git/git/pull/1901

Signature · 1 line
gitgitgadget