Subject: [PATCH v2 2/4] completion: simplify _git_notes

From: Nguyễn Thái Ngọc Duy <[email-masked]>
Date: Wed, 7 Mar 2018 08:05:02 +0700

This also adds completion for 'git notes remove' and 'git notes edit'.

Signed-off-by: Nguyễn Thái Ngọc Duy <[email-masked]>
---
 contrib/completion/git-completion.bash | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 0d858cacce..37bf4a64d3 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1836,19 +1836,11 @@ _git_notes ()
 	add,--reedit-message=*|append,--reedit-message=*)
 		__git_complete_refs --cur="${cur#*=}"
 		;;
-	add,--*)
-		__gitcomp_builtin notes_add
-		;;
-	append,--*)
-		__gitcomp_builtin notes_append
-		;;
-	copy,--*)
-		__gitcomp_builtin notes_copy
-		;;
-	prune,--*)
-		__gitcomp_builtin notes_prune
+	*,--*)
+		__gitcomp_builtin notes_$subcommand
 		;;
 	prune,*)
+		# this command does not take a ref, do not complete it
 		;;
 	*)
 		case "$prev" in
-- 
2.16.2.785.g429c04a1b9