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

Re: [PATCH 1/3] bash completion: fix completion issues with fetch, pull, and push

From
Shawn O. Pearce <spearce@spearce.org>
Date
Mar 6, 2009, 15:58 UTC
Message-ID
<20090306155814.GG16213@spearce.org>
In-Reply-To
<07bd381f7984117681504ce57c1f6c40aecafed3.1236314073.git.jaysoffian@gmail.com>
Jay Soffian <jaysoffian@gmail.com> wrote:
Show 22 quoted lines
> Sverre Rabbelier noticed a completion issue with push:
> 
>  $ git push ori<tab>
>  git push origin
> 
>  $ git push -f ori<tab>
>  git push -f origin/
> 
> Markus Heidelberg pointed out that the issue extends to fetch and pull.
> 
> The reason is that the current code naively assumes that if
> COMP_CWORD=2, it should complete a remote name, otherwise it should
> complete a refspec. This assumption fails if there are any --options.
> 
> This patch fixes that issue by instead scanning COMP_CWORDS to see if
> the remote has been completed yet (we now assume the first non-dashed
> argument is the remote). The new logic is factored into a function,
> shared by fetch, pull, and push.
> 
> The new function also properly handles '.' as the remote.
> 
> Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
> ---
>  contrib/completion/git-completion.bash |  109 +++++++++++++++++--------------
>  1 files changed, 60 insertions(+), 49 deletions(-)
-- 
Shawn.
Previous: Jay SoffianNext: Nanako Shiraishi
Message 3 of 14 in “improve bash completion of fetch, pull, and push”
  1. 0/3 improve bash completion of fetch, pull, and pushJay Soffian, Mar 6, 2009
  2. 1/3 bash completion: fix completion issues with fetch, pull, and pushJay Soffian, Mar 6, 2009
  3. Shawn O. PearceMar 6, 2009
  4. Nanako ShiraishiMar 11, 2009
  5. Jay SoffianMar 11, 2009
  6. 2/3 bash completion: refactor --strategy completionJay Soffian, Mar 6, 2009
  7. Shawn O. PearceMar 6, 2009
  8. Jay SoffianMar 6, 2009
  9. Shawn O. PearceMar 6, 2009
  10. Jay SoffianMar 6, 2009
  11. Shawn O. PearceMar 6, 2009
  12. 3/3 bash completion: teach fetch, pull, and push to complete their optionsJay Soffian, Mar 6, 2009
  13. Shawn O. PearceMar 6, 2009
  14. Sverre RabbelierMar 6, 2009

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.