DORMANTno replies

[PATCH] completion: complete refs after 'git restore -s'

From: Ákos Uzonyi <hidden>
Date: 2020-09-25 14:26:04
Subsystem: the rest · Maintainer: Linus Torvalds

From: Uzonyi Ákos <redacted>

Currently only the long version (--source=) supports completion.

Add completion support to the short (-s) option too.

Signed-off-by: Ákos Uzonyi <redacted>
---
 contrib/completion/git-completion.bash | 12 ++++++++++++
 1 file changed, 12 insertions(+)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 8be4a0316e..50e6e82157 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2853,6 +2853,18 @@ _git_restore ()
 	--*)
 		__gitcomp_builtin restore
 		;;
+	*)
+		local prevword prevword="${words[cword-1]}"
+
+		case "$prevword" in
+			-s)
+				__git_complete_refs
+				return
+				;;
+			*)
+				;;
+		esac
+		;;
 	esac
 }
 
-- 
2.28.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help