branch: lowercase error messages

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>

Anders Kaseorg committed Dec 1, 2021 at 14:15 UTC 7435e7e2e7645124679eedbfb1443b8408f29219
3 files changed +13 -13
branch.c
+10 -10
@@ -64,7 +64,7 @@ int install_branch_config(int flag, const char *local, const char *origin, const
64 if (skip_prefix(remote, "refs/heads/", &shortname)
65 && !strcmp(local, shortname)
66 && !origin) {
67 - warning(_("Not setting branch %s as its own upstream."),
67 + warning(_("not setting branch %s as its own upstream"),
68 local);
69 return 0;
70 }
@@ -116,7 +116,7 @@ int install_branch_config(int flag, const char *local, const char *origin, const
116
117 out_err:
118 strbuf_release(&key);
119 - error(_("Unable to write upstream branch configuration"));
119 + error(_("unable to write upstream branch configuration"));
120
121 advise(_(tracking_advice),
122 origin ? origin : "",
@@ -153,7 +153,7 @@ static void setup_tracking(const char *new_ref, const char *orig_ref,
153 }
154
155 if (tracking.matches > 1)
156 - die(_("Not tracking: ambiguous information for ref %s"),
156 + die(_("not tracking: ambiguous information for ref %s"),
157 orig_ref);
158
159 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)
186 int validate_branchname(const char *name, struct strbuf *ref)
187 {
188 if (strbuf_check_branch_ref(ref, name))
189 - die(_("'%s' is not a valid branch name."), name);
189 + die(_("'%s' is not a valid branch name"), name);
190
191 return ref_exists(ref->buf);
192 }
@@ -205,12 +205,12 @@ int validate_new_branchname(const char *name, struct strbuf *ref, int force)
205 return 0;
206
207 if (!force)
208 - die(_("A branch named '%s' already exists."),
208 + die(_("a branch named '%s' already exists"),
209 ref->buf + strlen("refs/heads/"));
210
211 head = resolve_ref_unsafe("HEAD", 0, NULL, NULL);
212 if (!is_bare_repository() && head && !strcmp(head, ref->buf))
213 - die(_("Cannot force update the current branch."));
213 + die(_("cannot force update the current branch"));
214
215 return 1;
216 }
@@ -230,7 +230,7 @@ static int validate_remote_tracking_branch(char *ref)
230 }
231
232 static const char upstream_not_branch[] =
233 -N_("Cannot setup tracking information; starting point '%s' is not a branch.");
233 +N_("cannot set up tracking information; starting point '%s' is not a branch");
234 static const char upstream_missing[] =
235 N_("the requested upstream branch '%s' does not exist");
236 static const char upstream_advice[] =
@@ -278,7 +278,7 @@ void create_branch(struct repository *r,
278 }
279 die(_(upstream_missing), start_name);
280 }
281 - die(_("Not a valid object name: '%s'."), start_name);
281 + die(_("not a valid object name: '%s'"), start_name);
282 }
283
284 switch (dwim_ref(start_name, strlen(start_name), &oid, &real_ref, 0)) {
@@ -298,12 +298,12 @@ void create_branch(struct repository *r,
298 }
299 break;
300 default:
301 - die(_("Ambiguous object name: '%s'."), start_name);
301 + die(_("ambiguous object name: '%s'"), start_name);
302 break;
303 }
304
305 if ((commit = lookup_commit_reference(r, &oid)) == NULL)
306 - die(_("Not a valid branch point: '%s'."), start_name);
306 + die(_("not a valid branch point: '%s'"), start_name);
307 oidcpy(&oid, &commit->object.oid);
308
309 if (reflog)
t/t2018-checkout-branch.sh
+1 -1
@@ -148,7 +148,7 @@ test_expect_success 'checkout -b to an existing branch fails' '
148 test_expect_success 'checkout -b to @{-1} fails with the right branch name' '
149 git checkout branch1 &&
150 git checkout branch2 &&
151 - echo >expect "fatal: A branch named '\''branch1'\'' already exists." &&
151 + echo >expect "fatal: a branch named '\''branch1'\'' already exists" &&
152 test_must_fail git checkout -b @{-1} 2>actual &&
153 test_cmp expect actual
154 '
t/t3200-branch.sh
+2 -2
@@ -888,7 +888,7 @@ test_expect_success '--set-upstream-to fails on a missing src branch' '
888 '
889
890 test_expect_success '--set-upstream-to fails on a non-ref' '
891 - echo "fatal: Cannot setup tracking information; starting point '"'"'HEAD^{}'"'"' is not a branch." >expect &&
891 + echo "fatal: cannot set up tracking information; starting point '"'"'HEAD^{}'"'"' is not a branch" >expect &&
892 test_must_fail git branch --set-upstream-to HEAD^{} 2>err &&
893 test_cmp expect err
894 '
@@ -975,7 +975,7 @@ test_expect_success 'disabled option --set-upstream fails' '
975 test_expect_success '--set-upstream-to notices an error to set branch as own upstream' '
976 git branch --set-upstream-to refs/heads/my13 my13 2>actual &&
977 cat >expect <<-\EOF &&
978 - warning: Not setting branch my13 as its own upstream.
978 + warning: not setting branch my13 as its own upstream
979 EOF
980 test_expect_code 1 git config branch.my13.remote &&
981 test_expect_code 1 git config branch.my13.merge &&