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>
This commit is contained in:
Nguyễn Thái Ngọc Duy 2018-02-09 18:01:48 +07:00 коммит произвёл Junio C Hamano
Родитель c01b56a3a8
Коммит 77afafb2e3
3 изменённых файлов: 13 добавлений и 12 удалений

Просмотреть файл

@ -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")),

Просмотреть файл

@ -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

Просмотреть файл

@ -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
'