completion: suppress some -no- options
Most --no- options do have some use, even if rarely to negate some option that's specified in an alias. These options --no-ours and --no-theirs however have no clear semantics. If I specify "--ours --no-theirs", the second will reset writeout stage and is equivalent of "--no-ours --no-theirs" which is not that easy to see. Drop them. You can either switch from --ours to --theirs and back but you can never negate them. 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
May 27, 2018 at 10:38 UTC
3fe735e723102b631a5509dc5f2ce835616d92e7
2 files changed
+6
-6
builtin/checkout.c
+6
-4
@@ -1119,10 +1119,12 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
1119
OPT_SET_INT('t', "track", &opts.track, N_("set upstream info for new branch"),
1120
BRANCH_TRACK_EXPLICIT),
1121
OPT_STRING(0, "orphan", &opts.new_orphan_branch, N_("new-branch"), N_("new unparented branch")),
1122
- OPT_SET_INT('2', "ours", &opts.writeout_stage, N_("checkout our version for unmerged files"),
1123
- 2),
1124
- OPT_SET_INT('3', "theirs", &opts.writeout_stage, N_("checkout their version for unmerged files"),
1125
- 3),
1122
+ OPT_SET_INT_F('2', "ours", &opts.writeout_stage,
1123
+ N_("checkout our version for unmerged files"),
1124
+ 2, PARSE_OPT_NONEG),
1125
+ OPT_SET_INT_F('3', "theirs", &opts.writeout_stage,
1126
+ N_("checkout their version for unmerged files"),
1127
+ 3, PARSE_OPT_NONEG),
1128
OPT__FORCE(&opts.force, N_("force checkout (throw away local modifications)"),
1129
PARSE_OPT_NOCOMPLETE),
1130
OPT_BOOL('m', "merge", &opts.merge, N_("perform a 3-way merge with the new branch")),
t/t9902-completion.sh
-2
@@ -1245,9 +1245,7 @@ test_expect_success 'double dash "git checkout"' '
1245
--orphan=Z
1246
--no-orphan Z
1247
--ours Z
1248
- --no-ours Z
1248
--theirs Z
1250
- --no-theirs Z
1249
--merge Z
1250
--no-merge Z
1251
--conflict=Z