summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2018-02-09 18:01:48 +0700
committerJunio C Hamano <gitster@pobox.com>2018-02-09 10:24:50 -0800
commit77afafb2e3c09323d434c1f8a193a17684b8f109 (patch)
tree04ee2aa6f5eeb64634678890af230f04f3425dc0
parentc01b56a3a8a375e5473b2548fec55fa408f098e0 (diff)
downloadgit-77afafb2e3c09323d434c1f8a193a17684b8f109.tar.gz
completion: use __gitcomp_builtin in _git_checkout
The new completable options are: --ignore-other-worktrees --progress Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--builtin/checkout.c7
-rw-r--r--contrib/completion/git-completion.bash6
-rwxr-xr-xt/t9902-completion.sh12
3 files changed, 13 insertions, 12 deletions
diff --git a/builtin/checkout.c b/builtin/checkout.c
index 2a96358eb7..a6218024a6 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -1118,9 +1118,12 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
2),
OPT_SET_INT('3', "theirs", &opts.writeout_stage, N_("checkout their version for unmerged files"),
3),
- OPT__FORCE(&opts.force, N_("force checkout (throw away local modifications)"), 0),
+ OPT__FORCE(&opts.force, N_("force checkout (throw away local modifications)"),
+ PARSE_OPT_NOCOMPLETE),
OPT_BOOL('m', "merge", &opts.merge, N_("perform a 3-way merge with the new branch")),
- OPT_BOOL(0, "overwrite-ignore", &opts.overwrite_ignore, N_("update ignored files (default)")),
+ OPT_BOOL_F(0, "overwrite-ignore", &opts.overwrite_ignore,
+ N_("update ignored files (default)"),
+ PARSE_OPT_NOCOMPLETE),
OPT_STRING(0, "conflict", &conflict_style, N_("style"),
N_("conflict style (merge or diff3)")),
OPT_BOOL('p', "patch", &opts.patch_mode, N_("select hunks interactively")),
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index d926518fb7..7e312f95e9 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1263,11 +1263,7 @@ _git_checkout ()
__gitcomp "diff3 merge" "" "${cur##--conflict=}"
;;
--*)
- __gitcomp "
- --quiet --ours --theirs --track --no-track --merge
- --conflict= --orphan --patch --detach --ignore-skip-worktree-bits
- --recurse-submodules --no-recurse-submodules
- "
+ __gitcomp_builtin checkout "--no-track --no-recurse-submodules"
;;
*)
# check if --track, --no-track, or --no-guess was specified
diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh
index fc614dcbfa..e6485feb0a 100755
--- a/t/t9902-completion.sh
+++ b/t/t9902-completion.sh
@@ -1237,17 +1237,19 @@ test_expect_success 'double dash "git" itself' '
test_expect_success 'double dash "git checkout"' '
test_completion "git checkout --" <<-\EOF
--quiet Z
+ --detach Z
+ --track Z
+ --orphan=Z
--ours Z
--theirs Z
- --track Z
- --no-track Z
--merge Z
- --conflict=
- --orphan Z
+ --conflict=Z
--patch Z
- --detach Z
--ignore-skip-worktree-bits Z
+ --ignore-other-worktrees Z
--recurse-submodules Z
+ --progress Z
+ --no-track Z
--no-recurse-submodules Z
EOF
'