Skip to content

Commit 3fe735e

Browse files
pcloudsgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2b1c01d commit 3fe735e

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

builtin/checkout.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,10 +1119,12 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
11191119
OPT_SET_INT('t', "track", &opts.track, N_("set upstream info for new branch"),
11201120
BRANCH_TRACK_EXPLICIT),
11211121
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),
11261128
OPT__FORCE(&opts.force, N_("force checkout (throw away local modifications)"),
11271129
PARSE_OPT_NOCOMPLETE),
11281130
OPT_BOOL('m', "merge", &opts.merge, N_("perform a 3-way merge with the new branch")),

t/t9902-completion.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,9 +1245,7 @@ test_expect_success 'double dash "git checkout"' '
12451245
--orphan=Z
12461246
--no-orphan Z
12471247
--ours Z
1248-
--no-ours Z
12491248
--theirs Z
1250-
--no-theirs Z
12511249
--merge Z
12521250
--no-merge Z
12531251
--conflict=Z

0 commit comments

Comments
 (0)