Skip to content

Commit 7a60e3b

Browse files
pcloudsgitster
authored andcommitted
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>
1 parent d73a59d commit 7a60e3b

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

builtin/notes.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ static int add(int argc, const char **argv, const char *prefix)
413413
parse_reuse_arg},
414414
OPT_BOOL(0, "allow-empty", &allow_empty,
415415
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),
417417
OPT_END()
418418
};
419419

@@ -484,7 +484,7 @@ static int copy(int argc, const char **argv, const char *prefix)
484484
struct notes_tree *t;
485485
const char *rewrite_cmd = NULL;
486486
struct option options[] = {
487-
OPT__FORCE(&force, N_("replace existing notes"), 0),
487+
OPT__FORCE(&force, N_("replace existing notes"), PARSE_OPT_NOCOMPLETE),
488488
OPT_BOOL(0, "stdin", &from_stdin, N_("read objects from stdin")),
489489
OPT_STRING(0, "for-rewrite", &rewrite_cmd, N_("command"),
490490
N_("load rewriting config for <command> (implies "

contrib/completion/git-completion.bash

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1835,7 +1835,7 @@ _git_notes ()
18351835

18361836
case "$subcommand,$cur" in
18371837
,--*)
1838-
__gitcomp '--ref'
1838+
__gitcomp_builtin notes
18391839
;;
18401840
,*)
18411841
case "$prev" in
@@ -1851,15 +1851,17 @@ _git_notes ()
18511851
add,--reedit-message=*|append,--reedit-message=*)
18521852
__git_complete_refs --cur="${cur#*=}"
18531853
;;
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
18571859
;;
18581860
copy,--*)
1859-
__gitcomp '--stdin'
1861+
__gitcomp_builtin notes_copy
18601862
;;
18611863
prune,--*)
1862-
__gitcomp '--dry-run --verbose'
1864+
__gitcomp_builtin notes_prune
18631865
;;
18641866
prune,*)
18651867
;;

0 commit comments

Comments
 (0)