[PATCH v2 06/41] completion: use __gitcomp_builtin in _git_am

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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=

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx>
---
 builtin/am.c                           | 16 ++++++++--------
 contrib/completion/git-completion.bash |  7 +------
 parse-options.h                        |  4 ++--
 rerere.h                               |  3 ++-
 4 files changed, 13 insertions(+), 17 deletions(-)

diff --git a/builtin/am.c b/builtin/am.c
index acfe9d3c8c..d42832dc0b 100644
--- a/builtin/am.c
+++ b/builtin/am.c
@@ -2237,18 +2237,18 @@ int cmd_am(int argc, const char **argv, const char *prefix)
 			PARSE_OPT_NOARG),
 		OPT_STRING(0, "resolvemsg", &state.resolvemsg, NULL,
 			N_("override error message when patch failure occurs")),
-		OPT_CMDMODE(0, "continue", &resume,
+		OPT_CMDMODE_F(0, "continue", &resume,
 			N_("continue applying patches after resolving a conflict"),
-			RESUME_RESOLVED),
-		OPT_CMDMODE('r', "resolved", &resume,
+			RESUME_RESOLVED, PARSE_OPT_NOCOMPLETE),
+		OPT_CMDMODE_F('r', "resolved", &resume,
 			N_("synonyms for --continue"),
-			RESUME_RESOLVED),
-		OPT_CMDMODE(0, "skip", &resume,
+			RESUME_RESOLVED, PARSE_OPT_NOCOMPLETE),
+		OPT_CMDMODE_F(0, "skip", &resume,
 			N_("skip the current patch"),
-			RESUME_SKIP),
-		OPT_CMDMODE(0, "abort", &resume,
+			RESUME_SKIP, PARSE_OPT_NOCOMPLETE),
+		OPT_CMDMODE_F(0, "abort", &resume,
 			N_("restore the original branch and abort the patching operation."),
-			RESUME_ABORT),
+			RESUME_ABORT, PARSE_OPT_NOCOMPLETE),
 		OPT_BOOL(0, "committer-date-is-author-date",
 			&state.committer_date_is_author_date,
 			N_("lie about committer date")),
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 9aa3aa241b..ce53b78c81 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1110,12 +1110,7 @@ _git_am ()
 		return
 		;;
 	--*)
-		__gitcomp "
-			--3way --committer-date-is-author-date --ignore-date
-			--ignore-whitespace --ignore-space-change
-			--interactive --keep --no-utf8 --signoff --utf8
-			--whitespace= --scissors
-			"
+		__gitcomp_builtin am "--no-utf8"
 		return
 	esac
 }
diff --git a/parse-options.h b/parse-options.h
index 23c912b842..fa75df17b4 100644
--- a/parse-options.h
+++ b/parse-options.h
@@ -146,8 +146,8 @@ struct option {
 #define OPT_STRING_LIST(s, l, v, a, h) \
 				    { OPTION_CALLBACK, (s), (l), (v), (a), \
 				      (h), 0, &parse_opt_string_list }
-#define OPT_UYN(s, l, v, h)         { OPTION_CALLBACK, (s), (l), (v), NULL, \
-				      (h), PARSE_OPT_NOARG, &parse_opt_tertiary }
+#define OPT_UYN(s, l, v, h, f)      { OPTION_CALLBACK, (s), (l), (v), NULL, \
+				      (h), PARSE_OPT_NOARG|(f), &parse_opt_tertiary }
 #define OPT_DATE(s, l, v, h) \
 	{ OPTION_CALLBACK, (s), (l), (v), N_("time"),(h), 0,	\
 	  parse_opt_approxidate_cb }
diff --git a/rerere.h b/rerere.h
index c2961feaaa..5e5a312e4c 100644
--- a/rerere.h
+++ b/rerere.h
@@ -37,6 +37,7 @@ extern void rerere_clear(struct string_list *);
 extern void rerere_gc(struct string_list *);
 
 #define OPT_RERERE_AUTOUPDATE(v) OPT_UYN(0, "rerere-autoupdate", (v), \
-	N_("update the index with reused conflict resolution if possible"))
+	N_("update the index with reused conflict resolution if possible"), \
+	PARSE_OPT_NOCOMPLETE)
 
 #endif
-- 
2.16.1.205.g271f633410




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux