git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
David Mandelberg via GitGitGadget <gitgitgadget@gmail.com>
Date
Mar 2, 2025, 07:45 UTC
Message-ID
<pull.1901.git.git.1740901525.gitgitgadget@gmail.com>

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
-- 
gitgitgadget
Next: David Mandelberg via GitGitGadget
Message 1 of 44 in “completion: fix bugs with slashes in remote names”
  1. 0/3 completion: fix bugs with slashes in remote namesDavid Mandelberg via GitGitGadget, Mar 2, 2025
  2. 1/3 completion: add helper to escape strings for fnmatchDavid Mandelberg via GitGitGadget, Mar 2, 2025
  3. 2/3 completion: add helper to count path componentsDavid Mandelberg via GitGitGadget, Mar 2, 2025
  4. 3/3 completion: fix bugs with slashes in remote namesDavid Mandelberg via GitGitGadget, Mar 2, 2025
  5. Phillip WoodMar 2, 2025
  6. David MandelbergMar 2, 2025
  7. phillip.wood123@gmail.comMar 3, 2025
  8. David MandelbergMar 3, 2025
  9. Todd ZullingerMar 3, 2025
  10. D. Ben KnobleMar 6, 2025
  11. D. Ben KnobleMar 6, 2025
  12. Junio C HamanoMar 6, 2025
  13. phillip.wood123@gmail.comMar 7, 2025
  14. David MandelbergMar 7, 2025
  15. D. Ben KnobleMar 13, 2025
  16. David MandelbergMar 13, 2025
  17. Junio C HamanoMar 3, 2025
  18. SZEDER GáborMar 3, 2025
  19. David MandelbergMar 3, 2025
  20. Junio C HamanoMar 6, 2025
  21. David MandelbergMar 7, 2025
  22. Junio C HamanoMar 7, 2025
  23. David MandelbergMar 7, 2025
  24. Junio C HamanoMar 7, 2025
  25. 0/2 completion: fix bugs with slashes in remote namesDavid Mandelberg, Mar 5, 2025
  26. 1/2 completion: add helper to count path componentsDavid Mandelberg, Mar 5, 2025
  27. 2/2 completion: fix bugs with slashes in remote namesDavid Mandelberg, Mar 5, 2025
  28. David MandelbergMar 5, 2025
  29. Phillip WoodMar 6, 2025
  30. David MandelbergMar 6, 2025
  31. Phillip WoodMar 6, 2025
  32. 0/2 completion: fix bugs with slashes in remote namesDavid Mandelberg, Mar 14, 2025
  33. 1/2 completion: add helper to count path componentsDavid Mandelberg, Mar 14, 2025
  34. 2/2 completion: fix bugs with slashes in remote namesDavid Mandelberg, Mar 14, 2025
  35. Junio C HamanoMar 14, 2025
  36. David MandelbergMar 14, 2025
  37. Junio C HamanoMar 14, 2025
  38. Phillip WoodMar 18, 2025
  39. Junio C HamanoMar 18, 2025
  40. 0/2 completion: fix bugs with slashes in remote namesDavid Mandelberg, Mar 23, 2025
  41. 1/2 completion: add helper to count path componentsDavid Mandelberg, Mar 23, 2025
  42. 2/2 completion: fix bugs with slashes in remote namesDavid Mandelberg, Mar 23, 2025
  43. Phillip WoodApr 8, 2025
  44. David MandelbergApr 8, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.