]> git.ipfire.org Git - thirdparty/git.git/commitdiff
worktree: standardize incompatibility messages
authorRené Scharfe <l.s.r@web.de>
Wed, 6 Dec 2023 11:52:00 +0000 (12:52 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 8 Dec 2023 22:41:03 +0000 (07:41 +0900)
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/worktree.c
t/t2400-worktree-add.sh

index 62b7e26f4bdb17f524914ab6e60143915d8f2565..036ceaa98107af2d7902dab33f22679b496433ad 100644 (file)
@@ -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>"));
index df4aff7825c9f8430d7449d1bdf2b0d5045d397a..245656b53a9702566c33043b7965ece1d8662add 100755 (executable)
@@ -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" &&