completion: use __gitcomp_builtin in _git_am
The new completable options are: --directory --exclude --gpg-sign --include --keep-cr --keep-non-patch --message-id --no-keep-cr --patch-format --quiet --reject --resolvemsg= In-progress options like --continue will be part of --git-completion-helper then filtered out by _git_am() unless the operation is in progress. This helps keep marking of these operations in just one place. 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:01 UTC
be3ce6b2505467d445c671feeb76e7ad1c40aee7
3 files changed
+8
-10
contrib/completion/git-completion.bash
+4
-7
@@ -1105,12 +1105,13 @@ __git_count_arguments ()
1105
}
1106
1107
__git_whitespacelist="nowarn warn error error-all fix"
1108
+__git_am_inprogress_options="--skip --continue --resolved --abort"
1109
1110
_git_am ()
1111
{
1112
__git_find_repo_path
1113
if [ -d "$__git_repo_path"/rebase-apply ]; then
1113
- __gitcomp "--skip --continue --resolved --abort"
1114
+ __gitcomp "$__git_am_inprogress_options"
1115
return
1116
fi
1117
case "$cur" in
@@ -1119,12 +1120,8 @@ _git_am ()
1120
return
1121
;;
1122
--*)
1122
- __gitcomp "
1123
- --3way --committer-date-is-author-date --ignore-date
1124
- --ignore-whitespace --ignore-space-change
1125
- --interactive --keep --no-utf8 --signoff --utf8
1126
- --whitespace= --scissors
1127
- "
1123
+ __gitcomp_builtin am "--no-utf8" \
1124
+ "$__git_am_inprogress_options"
1125
return
1126
esac
1127
}
parse-options.h
+2
-2
@@ -144,8 +144,8 @@ struct option {
144
#define OPT_STRING_LIST(s, l, v, a, h) \
145
{ OPTION_CALLBACK, (s), (l), (v), (a), \
146
(h), 0, &parse_opt_string_list }
147
-#define OPT_UYN(s, l, v, h) { OPTION_CALLBACK, (s), (l), (v), NULL, \
148
- (h), PARSE_OPT_NOARG, &parse_opt_tertiary }
147
+#define OPT_UYN(s, l, v, h, f) { OPTION_CALLBACK, (s), (l), (v), NULL, \
148
+ (h), PARSE_OPT_NOARG|(f), &parse_opt_tertiary }
149
#define OPT_DATE(s, l, v, h) \
150
{ OPTION_CALLBACK, (s), (l), (v), N_("time"),(h), 0, \
151
parse_opt_approxidate_cb }
rerere.h
+2
-1
@@ -37,6 +37,7 @@ extern void rerere_clear(struct string_list *);
37
extern void rerere_gc(struct string_list *);
38
39
#define OPT_RERERE_AUTOUPDATE(v) OPT_UYN(0, "rerere-autoupdate", (v), \
40
- N_("update the index with reused conflict resolution if possible"))
40
+ N_("update the index with reused conflict resolution if possible"), \
41
+ PARSE_OPT_NOCOMPLETE)
42
43
#endif