completion: use __gitcomp_builtin in _git_notes

The new completable options are: --allow-empty (notes add and notes append) --for-rewrite= (notes copy) Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Nguyễn Thái Ngọc Duy committed Feb 9, 2018 at 18:02 UTC 7a60e3bb830a7e07be23316035a095b7ca36ae27
2 files changed +10 -8
builtin/notes.c
+2 -2
@@ -413,7 +413,7 @@ static int add(int argc, const char **argv, const char *prefix)
413 parse_reuse_arg},
414 OPT_BOOL(0, "allow-empty", &allow_empty,
415 N_("allow storing empty note")),
416 - OPT__FORCE(&force, N_("replace existing notes"), 0),
416 + OPT__FORCE(&force, N_("replace existing notes"), PARSE_OPT_NOCOMPLETE),
417 OPT_END()
418 };
419
@@ -484,7 +484,7 @@ static int copy(int argc, const char **argv, const char *prefix)
484 struct notes_tree *t;
485 const char *rewrite_cmd = NULL;
486 struct option options[] = {
487 - OPT__FORCE(&force, N_("replace existing notes"), 0),
487 + OPT__FORCE(&force, N_("replace existing notes"), PARSE_OPT_NOCOMPLETE),
488 OPT_BOOL(0, "stdin", &from_stdin, N_("read objects from stdin")),
489 OPT_STRING(0, "for-rewrite", &rewrite_cmd, N_("command"),
490 N_("load rewriting config for <command> (implies "
contrib/completion/git-completion.bash
+8 -6
@@ -1835,7 +1835,7 @@ _git_notes ()
1835
1836 case "$subcommand,$cur" in
1837 ,--*)
1838 - __gitcomp '--ref'
1838 + __gitcomp_builtin notes
1839 ;;
1840 ,*)
1841 case "$prev" in
@@ -1851,15 +1851,17 @@ _git_notes ()
1851 add,--reedit-message=*|append,--reedit-message=*)
1852 __git_complete_refs --cur="${cur#*=}"
1853 ;;
1854 - add,--*|append,--*)
1855 - __gitcomp '--file= --message= --reedit-message=
1856 - --reuse-message='
1854 + add,--*)
1855 + __gitcomp_builtin notes_add
1856 + ;;
1857 + append,--*)
1858 + __gitcomp_builtin notes_append
1859 ;;
1860 copy,--*)
1859 - __gitcomp '--stdin'
1861 + __gitcomp_builtin notes_copy
1862 ;;
1863 prune,--*)
1862 - __gitcomp '--dry-run --verbose'
1864 + __gitcomp_builtin notes_prune
1865 ;;
1866 prune,*)
1867 ;;