From: Junio C Hamano <gitster@pobox.com>
To: "Md Ferdous Alam via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Md Ferdous Alam <mdferdousalam1989@yahoo.com>
Subject: Re: [PATCH] cat-file: fix error and warning message formatting
Date: Mon, 23 Feb 2026 07:54:50 -0800 [thread overview]
Message-ID: <xmqqtsv7o3p1.fsf@gitster.g> (raw)
In-Reply-To: <pull.2052.git.1771836302101.gitgitgadget@gmail.com> (Md Ferdous Alam via GitGitGadget's message of "Mon, 23 Feb 2026 08:45:02 +0000")
"Md Ferdous Alam via GitGitGadget" <gitgitgadget@gmail.com> writes:
> From: mdferdousalam <mdferdousalam1989@yahoo.com>
>
> The CodingGuidelines state that error messages should not begin
> with a capital letter and should not end with a full stop. Fix
> the die(), error() and warning() messages in builtin/cat-file.c
> that violate these rules, and update the corresponding test
> expectations in t1006 and t8007.
>
> Signed-off-by: mdferdousalam <mdferdousalam1989@yahoo.com>
> ---
> cat-file: fix error and warning message formatting
>
> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2052%2Fmdferdousalam%2Ffix-error-messages-cat-file-v1
> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2052/mdferdousalam/fix-error-messages-cat-file-v1
> Pull-Request: https://github.com/gitgitgadget/git/pull/2052
It may be cleaner to deal with "Not a valid object name %s" that
appear in 5 other .c files in addition to cat-file.c in a single
patch (touching no other messages, just the "Not a valid object
name" one), and do the rest of cat-file.c in a second patch.
Have you audited third-party software that use Git plumbing commands
like "git cat-file" to make sure that they do not expect the current
and historical spelling to make sure this change will not break them?
Other than that, looking good. Thanks for working on it.
>
> builtin/cat-file.c | 8 ++++----
> t/t1006-cat-file.sh | 6 +++---
> t/t8007-cat-file-textconv.sh | 2 +-
> 3 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/builtin/cat-file.c b/builtin/cat-file.c
> index df8e87a81f..a8d564dd6a 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) {
> @@ -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();
>
> diff --git a/t/t1006-cat-file.sh b/t/t1006-cat-file.sh
> index 0eee3bb878..0283c7400d 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 c3735fb50d..3a69b03794 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: <bad rev>' '
> 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
>
> base-commit: 7c02d39fc2ed2702223c7674f73150d9a7e61ba4
next prev parent reply other threads:[~2026-02-23 15:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-23 8:45 [PATCH] cat-file: fix error and warning message formatting Md Ferdous Alam via GitGitGadget
2026-02-23 15:54 ` Junio C Hamano [this message]
2026-02-23 18:54 ` Engr Md Ferdous Alam
2026-02-23 19:59 ` Junio C Hamano
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqtsv7o3p1.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=mdferdousalam1989@yahoo.com \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox