summaryrefslogtreecommitdiff
path: root/builtin/checkout.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2018-05-27 08:38:27 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-05-29 04:28:47 (GMT)
commit3fe735e723102b631a5509dc5f2ce835616d92e7 (patch)
tree6e30e6a023ee69130f0b1e81f67cbe2968c7d46e /builtin/checkout.c
parent2b1c01d22ef280ef3a6efd70db2b9aa58359ee36 (diff)
downloadgit-3fe735e723102b631a5509dc5f2ce835616d92e7.zip
git-3fe735e723102b631a5509dc5f2ce835616d92e7.tar.gz
git-3fe735e723102b631a5509dc5f2ce835616d92e7.tar.bz2
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>
Diffstat (limited to 'builtin/checkout.c')
-rw-r--r--builtin/checkout.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/builtin/checkout.c b/builtin/checkout.c
index 2b3b768..c7670db 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -1119,10 +1119,12 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
OPT_SET_INT('t', "track", &opts.track, N_("set upstream info for new branch"),
BRANCH_TRACK_EXPLICIT),
OPT_STRING(0, "orphan", &opts.new_orphan_branch, N_("new-branch"), N_("new unparented branch")),
- OPT_SET_INT('2', "ours", &opts.writeout_stage, N_("checkout our version for unmerged files"),
- 2),
- OPT_SET_INT('3', "theirs", &opts.writeout_stage, N_("checkout their version for unmerged files"),
- 3),
+ OPT_SET_INT_F('2', "ours", &opts.writeout_stage,
+ N_("checkout our version for unmerged files"),
+ 2, PARSE_OPT_NONEG),
+ OPT_SET_INT_F('3', "theirs", &opts.writeout_stage,
+ N_("checkout their version for unmerged files"),
+ 3, PARSE_OPT_NONEG),
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")),