completion: use __gitcomp_builtin in _git_apply
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Fri, 9 Feb 2018 11:01:46 +0000 (18:01 +0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 9 Feb 2018 18:24:50 +0000 (10:24 -0800)
The new completable options are:

--3way
--allow-overlap
--build-fake-ancestor=
--directory
--exclude
--include

--index-info is no longer completable but that's because it's renamed to
--build-fake-ancestor in 26b2800768 (apply: get rid of --index-info in
favor of --build-fake-ancestor - 2007-09-17)

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
apply.c
contrib/completion/git-completion.bash
diff --git a/apply.c b/apply.c
index 321a9fa68d491f7e5e89dc9e398b067f67a10c77..65eb37e6a4ce15c235940131881c8c3ac4be9919 100644 (file)
--- a/apply.c
+++ b/apply.c
@@ -4943,8 +4943,9 @@ int apply_parse_options(int argc, const char **argv,
                        N_("make sure the patch is applicable to the current index")),
                OPT_BOOL(0, "cached", &state->cached,
                        N_("apply a patch without touching the working tree")),
-               OPT_BOOL(0, "unsafe-paths", &state->unsafe_paths,
-                       N_("accept a patch that touches outside the working area")),
+               OPT_BOOL_F(0, "unsafe-paths", &state->unsafe_paths,
+                          N_("accept a patch that touches outside the working area"),
+                          PARSE_OPT_NOCOMPLETE),
                OPT_BOOL(0, "apply", force_apply,
                        N_("also apply the patch (use with --stat/--summary/--check)")),
                OPT_BOOL('3', "3way", &state->threeway,
index eba482eb9ccbf72eb2aadf9ea6b9d4c1999b7123..2fd3fc999e023f1c0c68362f65fdce0342fdd45c 100644 (file)
@@ -1134,14 +1134,7 @@ _git_apply ()
                return
                ;;
        --*)
-               __gitcomp "
-                       --stat --numstat --summary --check --index
-                       --cached --index-info --reverse --reject --unidiff-zero
-                       --apply --no-add --exclude=
-                       --ignore-whitespace --ignore-space-change
-                       --whitespace= --inaccurate-eof --verbose
-                       --recount --directory=
-                       "
+               __gitcomp_builtin apply
                return
        esac
 }