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>
Nguyễn Thái Ngọc Duy committed
Feb 9, 2018 at 18:01 UTC
77afafb2e3c09323d434c1f8a193a17684b8f109
3 files changed
+13
-12
builtin/checkout.c
+5
-2
@@ -1118,9 +1118,12 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
1118
2),
1119
OPT_SET_INT('3', "theirs", &opts.writeout_stage, N_("checkout their version for unmerged files"),
1120
3),
1121
- OPT__FORCE(&opts.force, N_("force checkout (throw away local modifications)"), 0),
1121
+ OPT__FORCE(&opts.force, N_("force checkout (throw away local modifications)"),
1122
+ PARSE_OPT_NOCOMPLETE),
1123
OPT_BOOL('m', "merge", &opts.merge, N_("perform a 3-way merge with the new branch")),
1123
- OPT_BOOL(0, "overwrite-ignore", &opts.overwrite_ignore, N_("update ignored files (default)")),
1124
+ OPT_BOOL_F(0, "overwrite-ignore", &opts.overwrite_ignore,
1125
+ N_("update ignored files (default)"),
1126
+ PARSE_OPT_NOCOMPLETE),
1127
OPT_STRING(0, "conflict", &conflict_style, N_("style"),
1128
N_("conflict style (merge or diff3)")),
1129
OPT_BOOL('p', "patch", &opts.patch_mode, N_("select hunks interactively")),
contrib/completion/git-completion.bash
+1
-5
@@ -1263,11 +1263,7 @@ _git_checkout ()
1263
__gitcomp "diff3 merge" "" "${cur##--conflict=}"
1264
;;
1265
--*)
1266
- __gitcomp "
1267
- --quiet --ours --theirs --track --no-track --merge
1268
- --conflict= --orphan --patch --detach --ignore-skip-worktree-bits
1269
- --recurse-submodules --no-recurse-submodules
1270
- "
1266
+ __gitcomp_builtin checkout "--no-track --no-recurse-submodules"
1267
;;
1268
*)
1269
# check if --track, --no-track, or --no-guess was specified
t/t9902-completion.sh
+7
-5
@@ -1237,17 +1237,19 @@ test_expect_success 'double dash "git" itself' '
1237
test_expect_success 'double dash "git checkout"' '
1238
test_completion "git checkout --" <<-\EOF
1239
--quiet Z
1240
+ --detach Z
1241
+ --track Z
1242
+ --orphan=Z
1243
--ours Z
1244
--theirs Z
1242
- --track Z
1243
- --no-track Z
1245
--merge Z
1245
- --conflict=
1246
- --orphan Z
1246
+ --conflict=Z
1247
--patch Z
1248
- --detach Z
1248
--ignore-skip-worktree-bits Z
1249
+ --ignore-other-worktrees Z
1250
--recurse-submodules Z
1251
+ --progress Z
1252
+ --no-track Z
1253
--no-recurse-submodules Z
1254
EOF
1255
'