git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] completion: complete refs after 'git restore -s'
@ 2020-09-25 14:25 Ákos Uzonyi
  2020-09-25 17:30 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Ákos Uzonyi @ 2020-09-25 14:25 UTC (permalink / raw)
  To: git; +Cc: Uzonyi Ákos, Nguyễn Thái Ngọc Duy,
	Junio C Hamano

From: Uzonyi Ákos <uzonyi.akos@gmail.com>

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

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

Signed-off-by: Ákos Uzonyi <uzonyi.akos@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-09-25 20:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-25 14:25 [PATCH] completion: complete refs after 'git restore -s' Ákos Uzonyi
2020-09-25 17:30 ` Junio C Hamano
2020-09-25 19:59   ` Ákos Uzonyi

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).