summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--builtin/checkout.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/builtin/checkout.c b/builtin/checkout.c
index e855c64cfe..71e2589340 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -433,6 +433,16 @@ static int checkout_paths(const struct checkout_opts *opts,
die(_("'%s' must be used when '%s' is not specified"),
"--worktree", "--source");
+ if (opts->checkout_index && !opts->checkout_worktree &&
+ opts->writeout_stage)
+ die(_("'%s' or '%s' cannot be used with %s"),
+ "--ours", "--theirs", "--staged");
+
+ if (opts->checkout_index && !opts->checkout_worktree &&
+ opts->merge)
+ die(_("'%s' or '%s' cannot be used with %s"),
+ "--merge", "--conflict", "--staged");
+
if (opts->patch_mode) {
const char *patch_mode;