]> git.ipfire.org Git - thirdparty/git.git/commitdiff
branch: lowercase error messages
authorAnders Kaseorg <andersk@mit.edu>
Wed, 1 Dec 2021 22:15:42 +0000 (14:15 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 2 Dec 2021 06:18:25 +0000 (22:18 -0800)
Documentation/CodingGuidelines says “do not end error messages with a
full stop” and “do not capitalize the first word”.  Clean up existing
messages, some of which we will be touching in later steps in the
series, that deviate from these rules in this file, as a preparation for
the main part of the topic.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
branch.c
t/t2018-checkout-branch.sh
t/t3200-branch.sh

index 07a46430b3846f0fa4595f9ea0f98c2523e8d5f1..85777b939b5af21d32cf1be8c8509391c84d0c76 100644 (file)
--- a/branch.c
+++ b/branch.c
@@ -64,7 +64,7 @@ int install_branch_config(int flag, const char *local, const char *origin, const
        if (skip_prefix(remote, "refs/heads/", &shortname)
            && !strcmp(local, shortname)
            && !origin) {
-               warning(_("Not setting branch %s as its own upstream."),
+               warning(_("not setting branch %s as its own upstream"),
                        local);
                return 0;
        }
@@ -116,7 +116,7 @@ int install_branch_config(int flag, const char *local, const char *origin, const
 
 out_err:
        strbuf_release(&key);
-       error(_("Unable to write upstream branch configuration"));
+       error(_("unable to write upstream branch configuration"));
 
        advise(_(tracking_advice),
               origin ? origin : "",
@@ -153,7 +153,7 @@ static void setup_tracking(const char *new_ref, const char *orig_ref,
                }
 
        if (tracking.matches > 1)
-               die(_("Not tracking: ambiguous information for ref %s"),
+               die(_("not tracking: ambiguous information for ref %s"),
                    orig_ref);
 
        if (install_branch_config(config_flags, new_ref, tracking.remote,
@@ -186,7 +186,7 @@ int read_branch_desc(struct strbuf *buf, const char *branch_name)
 int validate_branchname(const char *name, struct strbuf *ref)
 {
        if (strbuf_check_branch_ref(ref, name))
-               die(_("'%s' is not a valid branch name."), name);
+               die(_("'%s' is not a valid branch name"), name);
 
        return ref_exists(ref->buf);
 }
@@ -205,12 +205,12 @@ int validate_new_branchname(const char *name, struct strbuf *ref, int force)
                return 0;
 
        if (!force)
-               die(_("A branch named '%s' already exists."),
+               die(_("a branch named '%s' already exists"),
                    ref->buf + strlen("refs/heads/"));
 
        head = resolve_ref_unsafe("HEAD", 0, NULL, NULL);
        if (!is_bare_repository() && head && !strcmp(head, ref->buf))
-               die(_("Cannot force update the current branch."));
+               die(_("cannot force update the current branch"));
 
        return 1;
 }
@@ -230,7 +230,7 @@ static int validate_remote_tracking_branch(char *ref)
 }
 
 static const char upstream_not_branch[] =
-N_("Cannot setup tracking information; starting point '%s' is not a branch.");
+N_("cannot set up tracking information; starting point '%s' is not a branch");
 static const char upstream_missing[] =
 N_("the requested upstream branch '%s' does not exist");
 static const char upstream_advice[] =
@@ -278,7 +278,7 @@ void create_branch(struct repository *r,
                        }
                        die(_(upstream_missing), start_name);
                }
-               die(_("Not a valid object name: '%s'."), start_name);
+               die(_("not a valid object name: '%s'"), start_name);
        }
 
        switch (dwim_ref(start_name, strlen(start_name), &oid, &real_ref, 0)) {
@@ -298,12 +298,12 @@ void create_branch(struct repository *r,
                }
                break;
        default:
-               die(_("Ambiguous object name: '%s'."), start_name);
+               die(_("ambiguous object name: '%s'"), start_name);
                break;
        }
 
        if ((commit = lookup_commit_reference(r, &oid)) == NULL)
-               die(_("Not a valid branch point: '%s'."), start_name);
+               die(_("not a valid branch point: '%s'"), start_name);
        oidcpy(&oid, &commit->object.oid);
 
        if (reflog)
index 93be1c0eae5ead7eeb4f37dab01dbc1c1fbacdba..3e93506c0455c0fc5666a9695282e5ac3a1f32e1 100755 (executable)
@@ -148,7 +148,7 @@ test_expect_success 'checkout -b to an existing branch fails' '
 test_expect_success 'checkout -b to @{-1} fails with the right branch name' '
        git checkout branch1 &&
        git checkout branch2 &&
-       echo  >expect "fatal: A branch named '\''branch1'\'' already exists." &&
+       echo  >expect "fatal: a branch named '\''branch1'\'' already exists" &&
        test_must_fail git checkout -b @{-1} 2>actual &&
        test_cmp expect actual
 '
index 8c5c1ccf3300432fb846a2a78488b33c9d752f7b..e35e119beeabc58b96bd5f6f10cbd1695db0a868 100755 (executable)
@@ -888,7 +888,7 @@ test_expect_success '--set-upstream-to fails on a missing src branch' '
 '
 
 test_expect_success '--set-upstream-to fails on a non-ref' '
-       echo "fatal: Cannot setup tracking information; starting point '"'"'HEAD^{}'"'"' is not a branch." >expect &&
+       echo "fatal: cannot set up tracking information; starting point '"'"'HEAD^{}'"'"' is not a branch" >expect &&
        test_must_fail git branch --set-upstream-to HEAD^{} 2>err &&
        test_cmp expect err
 '
@@ -975,7 +975,7 @@ test_expect_success 'disabled option --set-upstream fails' '
 test_expect_success '--set-upstream-to notices an error to set branch as own upstream' '
        git branch --set-upstream-to refs/heads/my13 my13 2>actual &&
        cat >expect <<-\EOF &&
-       warning: Not setting branch my13 as its own upstream.
+       warning: not setting branch my13 as its own upstream
        EOF
        test_expect_code 1 git config branch.my13.remote &&
        test_expect_code 1 git config branch.my13.merge &&