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

Re: Bash completion suggests tags for git branch -D

From
Jeff King <peff@peff.net>
Date
Feb 2, 2021, 09:21 UTC
Message-ID
<YBkZnY8X5VyNkXkR@coredump.intra.peff.net>
In-Reply-To
<YBkVFTOP6K1//i6m@coredump.intra.peff.net>
On Tue, Feb 02, 2021 at 04:02:13AM -0500, Jeff King wrote:
Show 18 quoted lines
> > b-is-a-tag is not a branch, so should not be offered as a completion
> > candidate in this instance.
> 
> It looks like lowercase "-d" works. So maybe the "-d" here:
> 
>   $ sed -n '/git_branch/,/^}/p' contrib/completion/git-completion.bash | head 
>   _git_branch ()
>   {
>   	local i c=1 only_local_ref="n" has_r="n"
>   
>   	while [ $c -lt $cword ]; do
>   		i="${words[c]}"
>   		case "$i" in
>   		-d|--delete|-D|-m|--move)	only_local_ref="y" ;;
>   		-r|--remotes)		has_r="y" ;;
>   		esac
> 
> just needs to look for "-D", too?

Oops. I meant to paste the "before" snippet, but this is obviously after I stuck "-D" in there. It does seem to work. :)

-Peff
Previous: Jeff KingNext: Junio C Hamano
Message 3 of 10 in “Bash completion suggests tags for git branch -D”
  1. Paul JollyFeb 2, 2021
  2. Jeff KingFeb 2, 2021
  3. Jeff KingFeb 2, 2021
  4. Junio C HamanoFeb 2, 2021
  5. Eric SunshineFeb 2, 2021
  6. Junio C HamanoFeb 2, 2021
  7. Jeff KingFeb 2, 2021
  8. Paul JollyFeb 2, 2021
  9. SZEDER GáborFeb 3, 2021
  10. completion: handle other variants of "branch -m"Jeff King, Feb 3, 2021

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.