Thread (1 message) 1 message, 1 author, 2021-02-02

Re: Bash completion suggests tags for git branch -D

From: Junio C Hamano <hidden>
Date: 2021-02-02 21:30:58
Subsystem: the rest · Maintainer: Linus Torvalds

Possibly related (same subject, not in this thread)

Eric Sunshine [off-list ref] writes:
On Tue, Feb 2, 2021 at 12:22 PM Junio C Hamano [off-list ref] wrote:
quoted
From: Jeff King <redacted>
Subject: [PATCH] completion: treat "branch -D" the same way as "branch -d"

Paul Jolly noticed that the former offers not just branches but tags
as completion candidates.  Mimic how "branch -d" limits its suggestion
to branch names.

Signed-off-by: Jeff King <redacted>
Signed-off-by: Junio C Hamano <redacted>
Perhaps a Reported-by: would be appropriate?
Comparing the way I wrote the above, and a bland description of
"this is broken how" plus "Reported-by:", I personally feel the
former gives the credit in a more proper way, but if more people
prefer the more mechanical style, I can adjust.

Here is what I queued.
--- >8 ------ >8 ------ >8 ------ >8 ------ >8 ---
From: Jeff King <redacted>
Date: Tue, 2 Feb 2021 04:02:13 -0500
Subject: [PATCH] completion: treat "branch -D" the same way as "branch -d"

The former offers not just branches but tags as completion
candidates.

Mimic how "branch -d" limits its suggestion to branch names.

Reported-by: Paul Jolly <redacted>
Signed-off-by: Jeff King <redacted>
Signed-off-by: Junio C Hamano <redacted>
---
 contrib/completion/git-completion.bash | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 463a3124da..ba950a247d 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1438,7 +1438,7 @@ _git_branch ()
 	while [ $c -lt $cword ]; do
 		i="${words[c]}"
 		case "$i" in
-		-d|--delete|-m|--move)	only_local_ref="y" ;;
+		-d|--delete|-D|-m|--move)	only_local_ref="y" ;;
 		-r|--remotes)		has_r="y" ;;
 		esac
 		((c++))
-- 
2.30.0-586-g047f30a795
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help