From: "René Scharfe" <l.s.r@web.de>
To: git@vger.kernel.org
Subject: [PATCH 6/7] worktree: standardize incompatibility messages
Date: Wed, 6 Dec 2023 12:52:00 +0100 [thread overview]
Message-ID: <20231206115215.94467-7-l.s.r@web.de> (raw)
In-Reply-To: <20231206115215.94467-1-l.s.r@web.de>
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 <l.s.r@web.de>
---
builtin/worktree.c | 17 +++++++++--------
t/t2400-worktree-add.sh | 2 +-
2 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/builtin/worktree.c b/builtin/worktree.c
index 62b7e26f4b..036ceaa981 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,13 +806,14 @@ 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>"));
diff --git a/t/t2400-worktree-add.sh b/t/t2400-worktree-add.sh
index df4aff7825..245656b53a 100755
--- a/t/t2400-worktree-add.sh
+++ b/t/t2400-worktree-add.sh
@@ -711,7 +711,7 @@ test_dwim_orphan () {
local fetch_error_text="fatal: No local or remote refs exist despite at least one remote" &&
local orphan_hint="hint: If you meant to create a worktree containing a new orphan branch" &&
local invalid_ref_regex="^fatal: invalid reference: " &&
- local bad_combo_regex="^fatal: '[-a-z]*' and '[-a-z]*' cannot be used together" &&
+ local bad_combo_regex="^fatal: options '[-a-z]*' and '[-a-z]*' cannot be used together" &&
local git_ns="repo" &&
local dashc_args="-C $git_ns" &&
--
2.43.0
next prev parent reply other threads:[~2023-12-06 11:53 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-06 11:51 [PATCH 0/7] standardize incompatibility messages René Scharfe
2023-12-06 11:51 ` [PATCH 1/7] push: use die_for_incompatible_opt4() for --delete/--tags/--all/--mirror René Scharfe
2023-12-06 11:51 ` [PATCH 2/7] repack: use die_for_incompatible_opt3() for -A/-k/--cruft René Scharfe
2023-12-06 19:18 ` Taylor Blau
2023-12-06 11:51 ` [PATCH 3/7] revision: use die_for_incompatible_opt3() for --graph/--reverse/--walk-reflogs René Scharfe
2023-12-06 13:08 ` Patrick Steinhardt
2023-12-06 13:47 ` René Scharfe
2023-12-06 17:21 ` Eric Sunshine
2023-12-06 17:29 ` René Scharfe
2023-12-06 11:51 ` [PATCH 4/7] revision, rev-parse: factorize incompatibility messages about --exclude-hidden René Scharfe
2023-12-06 13:08 ` Patrick Steinhardt
2023-12-06 14:21 ` René Scharfe
2023-12-06 14:39 ` Patrick Steinhardt
2023-12-06 17:07 ` René Scharfe
2023-12-06 19:25 ` Taylor Blau
2023-12-07 7:10 ` Patrick Steinhardt
2023-12-06 11:51 ` [PATCH 5/7] clean: factorize incompatibility message René Scharfe
2023-12-06 11:52 ` René Scharfe [this message]
2023-12-06 11:52 ` [PATCH 7/7] worktree: simplify incompatibility message for --orphan and commit-ish René Scharfe
2023-12-06 13:07 ` [PATCH 0/7] standardize incompatibility messages Patrick Steinhardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231206115215.94467-7-l.s.r@web.de \
--to=l.s.r@web.de \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).