aboutsummaryrefslogtreecommitdiffstats
path: root/builtin/worktree.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2023-12-20 10:14:53 -0800
committerJunio C Hamano <gitster@pobox.com>2023-12-20 10:14:53 -0800
commit3c8f932d3537809b93b5dce31d14532ed84731ea (patch)
treece0742c97513a4d54355623c31f20056d485e179 /builtin/worktree.c
parentMerge branch 'jc/revision-parse-int' (diff)
parentworktree: simplify incompatibility message for --orphan and commit-ish (diff)
downloadgit-3c8f932d3537809b93b5dce31d14532ed84731ea.tar.gz
git-3c8f932d3537809b93b5dce31d14532ed84731ea.zip
Merge branch 'rs/incompatible-options-messages'
Clean-up code that handles combinations of incompatible options. * rs/incompatible-options-messages: worktree: simplify incompatibility message for --orphan and commit-ish worktree: standardize incompatibility messages clean: factorize incompatibility message revision, rev-parse: factorize incompatibility messages about - -exclude-hidden revision: use die_for_incompatible_opt3() for - -graph/--reverse/--walk-reflogs repack: use die_for_incompatible_opt3() for -A/-k/--cruft push: use die_for_incompatible_opt4() for - -delete/--tags/--all/--mirror
Diffstat (limited to 'builtin/worktree.c')
-rw-r--r--builtin/worktree.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/builtin/worktree.c b/builtin/worktree.c
index 62b7e26f4b..4ac1621541 100644
--- a/builtin/worktree.c
+++ b/builtin/worktree.c
@@ -730,11 +730,11 @@ static int dwim_orphan(const struct add_opts *opts, int opt_track, int remote)
}
if (opt_track) {
- die(_("'%s' and '%s' cannot be used together"), "--orphan",
- "--track");
+ die(_("options '%s' and '%s' cannot be used together"),
+ "--orphan", "--track");
} else if (!opts->checkout) {
- die(_("'%s' and '%s' cannot be used together"), "--orphan",
- "--no-checkout");
+ die(_("options '%s' and '%s' cannot be used together"),
+ "--orphan", "--no-checkout");
}
return 1;
}
@@ -806,16 +806,17 @@ static int add(int ac, const char **av, const char *prefix)
if (!!opts.detach + !!new_branch + !!new_branch_force > 1)
die(_("options '%s', '%s', and '%s' cannot be used together"), "-b", "-B", "--detach");
if (opts.detach && opts.orphan)
- die(_("options '%s', and '%s' cannot be used together"),
+ die(_("options '%s' and '%s' cannot be used together"),
"--orphan", "--detach");
if (opts.orphan && opt_track)
- die(_("'%s' and '%s' cannot be used together"), "--orphan", "--track");
+ die(_("options '%s' and '%s' cannot be used together"),
+ "--orphan", "--track");
if (opts.orphan && !opts.checkout)
- die(_("'%s' and '%s' cannot be used together"), "--orphan",
- "--no-checkout");
+ die(_("options '%s' and '%s' cannot be used together"),
+ "--orphan", "--no-checkout");
if (opts.orphan && ac == 2)
- die(_("'%s' and '%s' cannot be used together"), "--orphan",
- _("<commit-ish>"));
+ die(_("option '%s' and commit-ish cannot be used together"),
+ "--orphan");
if (lock_reason && !keep_locked)
die(_("the option '%s' requires '%s'"), "--reason", "--lock");
if (lock_reason)