Skip to content

Commit 62bc6dd

Browse files
rscharfegitster
authored andcommitted
worktree: standardize incompatibility messages
Use the standard parameterized message for reporting incompatible options for worktree add. This reduces the number of strings to translate and makes the UI slightly more consistent. Signed-off-by: René Scharfe <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f5f9e97 commit 62bc6dd

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

builtin/worktree.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -730,11 +730,11 @@ static int dwim_orphan(const struct add_opts *opts, int opt_track, int remote)
730730
}
731731

732732
if (opt_track) {
733-
die(_("'%s' and '%s' cannot be used together"), "--orphan",
734-
"--track");
733+
die(_("options '%s' and '%s' cannot be used together"),
734+
"--orphan", "--track");
735735
} else if (!opts->checkout) {
736-
die(_("'%s' and '%s' cannot be used together"), "--orphan",
737-
"--no-checkout");
736+
die(_("options '%s' and '%s' cannot be used together"),
737+
"--orphan", "--no-checkout");
738738
}
739739
return 1;
740740
}
@@ -806,13 +806,14 @@ static int add(int ac, const char **av, const char *prefix)
806806
if (!!opts.detach + !!new_branch + !!new_branch_force > 1)
807807
die(_("options '%s', '%s', and '%s' cannot be used together"), "-b", "-B", "--detach");
808808
if (opts.detach && opts.orphan)
809-
die(_("options '%s', and '%s' cannot be used together"),
809+
die(_("options '%s' and '%s' cannot be used together"),
810810
"--orphan", "--detach");
811811
if (opts.orphan && opt_track)
812-
die(_("'%s' and '%s' cannot be used together"), "--orphan", "--track");
812+
die(_("options '%s' and '%s' cannot be used together"),
813+
"--orphan", "--track");
813814
if (opts.orphan && !opts.checkout)
814-
die(_("'%s' and '%s' cannot be used together"), "--orphan",
815-
"--no-checkout");
815+
die(_("options '%s' and '%s' cannot be used together"),
816+
"--orphan", "--no-checkout");
816817
if (opts.orphan && ac == 2)
817818
die(_("'%s' and '%s' cannot be used together"), "--orphan",
818819
_("<commit-ish>"));

t/t2400-worktree-add.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ test_dwim_orphan () {
711711
local fetch_error_text="fatal: No local or remote refs exist despite at least one remote" &&
712712
local orphan_hint="hint: If you meant to create a worktree containing a new orphan branch" &&
713713
local invalid_ref_regex="^fatal: invalid reference: " &&
714-
local bad_combo_regex="^fatal: '[-a-z]*' and '[-a-z]*' cannot be used together" &&
714+
local bad_combo_regex="^fatal: options '[-a-z]*' and '[-a-z]*' cannot be used together" &&
715715

716716
local git_ns="repo" &&
717717
local dashc_args="-C $git_ns" &&

0 commit comments

Comments
 (0)