From b76846a0391be786dc5523800a734ea9ce731810 Mon Sep 17 00:00:00 2001 From: Md Ferdous Alam Date: Mon, 23 Feb 2026 23:39:47 +0600 Subject: [PATCH 1/2] die: lowercase "Not a valid object name" messages The CodingGuidelines state that error messages should not begin with a capital letter. Lowercase the "Not a valid object name" die() messages that appear in cat-file, describe, ls-tree, merge-base, read-tree, and unpack-file, and update the corresponding test expectations in t1006 and t8007. Signed-off-by: Md Ferdous Alam --- builtin/cat-file.c | 4 ++-- builtin/describe.c | 2 +- builtin/ls-tree.c | 2 +- builtin/merge-base.c | 4 ++-- builtin/read-tree.c | 2 +- builtin/unpack-file.c | 2 +- t/t1006-cat-file.sh | 6 +++--- t/t8007-cat-file-textconv.sh | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/builtin/cat-file.c b/builtin/cat-file.c index df8e87a81f5eee..a79a5353dabcd8 100644 --- a/builtin/cat-file.c +++ b/builtin/cat-file.c @@ -121,7 +121,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name) if (get_oid_with_context(the_repository, obj_name, get_oid_flags, &oid, &obj_context)) - die("Not a valid object name %s", obj_name); + die("not a valid object name %s", obj_name); if (!path) path = obj_context.path; @@ -182,7 +182,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name) case 'p': type = odb_read_object_info(the_repository->objects, &oid, NULL); if (type < 0) - die("Not a valid object name %s", obj_name); + die("not a valid object name %s", obj_name); /* custom pretty-print here */ if (type == OBJ_TREE) { diff --git a/builtin/describe.c b/builtin/describe.c index abfe3525a5385b..5acc1ec09ad0f8 100644 --- a/builtin/describe.c +++ b/builtin/describe.c @@ -606,7 +606,7 @@ static void describe(const char *arg, int last_one) fprintf(stderr, _("describe %s\n"), arg); if (repo_get_oid(the_repository, arg, &oid)) - die(_("Not a valid object name %s"), arg); + die(_("not a valid object name %s"), arg); cmit = lookup_commit_reference_gently(the_repository, &oid, 1); if (cmit) diff --git a/builtin/ls-tree.c b/builtin/ls-tree.c index 113e4a960dc7dd..7670aa77a3ebc0 100644 --- a/builtin/ls-tree.c +++ b/builtin/ls-tree.c @@ -406,7 +406,7 @@ int cmd_ls_tree(int argc, usage_with_options(ls_tree_usage, ls_tree_options); if (repo_get_oid_with_flags(the_repository, argv[0], &oid, GET_OID_HASH_ANY)) - die("Not a valid object name %s", argv[0]); + die("not a valid object name %s", argv[0]); /* * show_recursive() rolls its own matching code and is diff --git a/builtin/merge-base.c b/builtin/merge-base.c index c7ee97fa6ac62a..214ce697a3dab0 100644 --- a/builtin/merge-base.c +++ b/builtin/merge-base.c @@ -47,7 +47,7 @@ static struct commit *get_commit_reference(const char *arg) struct commit *r; if (repo_get_oid(the_repository, arg, &revkey)) - die("Not a valid object name %s", arg); + die("not a valid object name %s", arg); r = lookup_commit_reference(the_repository, &revkey); if (!r) die("Not a valid commit name %s", arg); @@ -131,7 +131,7 @@ static int handle_fork_point(int argc, const char **argv) commitname = (argc == 2) ? argv[1] : "HEAD"; if (repo_get_oid(the_repository, commitname, &oid)) - die("Not a valid object name: '%s'", commitname); + die("not a valid object name: '%s'", commitname); derived = lookup_commit_reference(the_repository, &oid); diff --git a/builtin/read-tree.c b/builtin/read-tree.c index 460b21e40ac914..673d7bc0945dcf 100644 --- a/builtin/read-tree.c +++ b/builtin/read-tree.c @@ -210,7 +210,7 @@ int cmd_read_tree(int argc, const char *arg = argv[i]; if (repo_get_oid(the_repository, arg, &oid)) - die("Not a valid object name %s", arg); + die("not a valid object name %s", arg); if (list_tree(&oid) < 0) die("failed to unpack tree object %s", arg); stage++; diff --git a/builtin/unpack-file.c b/builtin/unpack-file.c index 87877a9fabc6f6..58a869ebecbf2c 100644 --- a/builtin/unpack-file.c +++ b/builtin/unpack-file.c @@ -42,7 +42,7 @@ int cmd_unpack_file(int argc, if (argc != 2) usage(usage_msg); if (repo_get_oid(the_repository, argv[1], &oid)) - die("Not a valid object name %s", argv[1]); + die("not a valid object name %s", argv[1]); repo_config(the_repository, git_default_config, NULL); diff --git a/t/t1006-cat-file.sh b/t/t1006-cat-file.sh index 0eee3bb8781b30..0283c7400d478a 100755 --- a/t/t1006-cat-file.sh +++ b/t/t1006-cat-file.sh @@ -705,7 +705,7 @@ do then cat >expect <<-EOF error: header for $bogus_long_oid too long, exceeds 32 bytes - fatal: Not a valid object name $bogus_long_oid + fatal: not a valid object name $bogus_long_oid EOF else cat >expect <<-EOF @@ -721,7 +721,7 @@ do test_expect_success "cat-file $arg1 error on missing short OID" ' cat >expect.err <<-EOF && - fatal: Not a valid object name $(test_oid deadbeef_short) + fatal: not a valid object name $(test_oid deadbeef_short) EOF test_must_fail git cat-file $arg1 $(test_oid deadbeef_short) >out 2>err.actual && test_must_be_empty out && @@ -732,7 +732,7 @@ do if test "$arg1" = "-p" then cat >expect.err <<-EOF - fatal: Not a valid object name $(test_oid deadbeef) + fatal: not a valid object name $(test_oid deadbeef) EOF else cat >expect.err <<-\EOF diff --git a/t/t8007-cat-file-textconv.sh b/t/t8007-cat-file-textconv.sh index c3735fb50de4cb..3a69b03794ec86 100755 --- a/t/t8007-cat-file-textconv.sh +++ b/t/t8007-cat-file-textconv.sh @@ -22,7 +22,7 @@ test_expect_success 'setup ' ' test_expect_success 'usage: ' ' cat >expect <<-\EOF && - fatal: Not a valid object name HEAD2 + fatal: not a valid object name HEAD2 EOF test_must_fail git cat-file --textconv HEAD2 2>actual && test_cmp expect actual From b7850034d7ed0d0d79af7a8ff06c946f995e524a Mon Sep 17 00:00:00 2001 From: Md Ferdous Alam Date: Mon, 23 Feb 2026 23:40:18 +0600 Subject: [PATCH 2/2] cat-file: fix remaining error and warning message formatting The CodingGuidelines state that error messages should not begin with a capital letter and should not end with a full stop. Fix the remaining die() and warning() messages in builtin/cat-file.c that violate these rules: lowercase "Cannot read object" and reformat the promisor remotes warning to not start with a capital letter and to use a semicolon instead of a full stop. Signed-off-by: Md Ferdous Alam --- builtin/cat-file.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/builtin/cat-file.c b/builtin/cat-file.c index a79a5353dabcd8..a8d564dd6a0640 100644 --- a/builtin/cat-file.c +++ b/builtin/cat-file.c @@ -200,7 +200,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name) buf = odb_read_object(the_repository->objects, &oid, &type, &size); if (!buf) - die("Cannot read object %s", obj_name); + die("cannot read object %s", obj_name); if (use_mailmap) { size_t s = size; @@ -910,7 +910,7 @@ static int batch_objects(struct batch_options *opt) data.skip_object_info = 1; if (repo_has_promisor_remote(the_repository)) - warning("This repository uses promisor remotes. Some objects may not be loaded."); + warning("this repository uses promisor remotes; some objects may not be loaded"); disable_replace_refs();