{"thread":{"id":"65046","subject":"[PATCH] cat-file: fix error and warning message formatting","startedAt":"2026-02-23T08:45:04Z","lastAt":"2026-02-23T19:59:23Z","messageCount":4,"participants":["Md Ferdous Alam via GitGitGadget","Junio C Hamano","Engr Md Ferdous Alam"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"536710","messageId":"pull.2052.git.1771836302101.gitgitgadget@gmail.com","threadId":"65046","inReplyTo":null,"subject":"[PATCH] cat-file: fix error and warning message formatting","fromName":"Md Ferdous Alam via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-02-23T08:45:02Z","receivedAt":"2026-02-23T08:45:04Z","isPatch":true,"sender":{"key":"name:Md Ferdous Alam","avatar":null},"body":"From: mdferdousalam <mdferdousalam1989@yahoo.com>\n\nThe CodingGuidelines state that error messages should not begin\nwith a capital letter and should not end with a full stop.  Fix\nthe die(), error() and warning() messages in builtin/cat-file.c\nthat violate these rules, and update the corresponding test\nexpectations in t1006 and t8007.\n\nSigned-off-by: mdferdousalam <mdferdousalam1989@yahoo.com>\n---\n    cat-file: fix error and warning message formatting\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-2052%2Fmdferdousalam%2Ffix-error-messages-cat-file-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2052/mdferdousalam/fix-error-messages-cat-file-v1\nPull-Request: https://github.com/gitgitgadget/git/pull/2052\n\n builtin/cat-file.c           | 8 ++++----\n t/t1006-cat-file.sh          | 6 +++---\n t/t8007-cat-file-textconv.sh | 2 +-\n 3 files changed, 8 insertions(+), 8 deletions(-)\n\ndiff --git a/builtin/cat-file.c b/builtin/cat-file.c\nindex df8e87a81f..a8d564dd6a 100644\n--- a/builtin/cat-file.c\n+++ b/builtin/cat-file.c\n@@ -121,7 +121,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name)\n \n \tif (get_oid_with_context(the_repository, obj_name, get_oid_flags, &oid,\n \t\t\t\t &obj_context))\n-\t\tdie(\"Not a valid object name %s\", obj_name);\n+\t\tdie(\"not a valid object name %s\", obj_name);\n \n \tif (!path)\n \t\tpath = obj_context.path;\n@@ -182,7 +182,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name)\n \tcase 'p':\n \t\ttype = odb_read_object_info(the_repository->objects, &oid, NULL);\n \t\tif (type < 0)\n-\t\t\tdie(\"Not a valid object name %s\", obj_name);\n+\t\t\tdie(\"not a valid object name %s\", obj_name);\n \n \t\t/* custom pretty-print here */\n \t\tif (type == OBJ_TREE) {\n@@ -200,7 +200,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name)\n \t\tbuf = odb_read_object(the_repository->objects, &oid,\n \t\t\t\t      &type, &size);\n \t\tif (!buf)\n-\t\t\tdie(\"Cannot read object %s\", obj_name);\n+\t\t\tdie(\"cannot read object %s\", obj_name);\n \n \t\tif (use_mailmap) {\n \t\t\tsize_t s = size;\n@@ -910,7 +910,7 @@ static int batch_objects(struct batch_options *opt)\n \t\t\tdata.skip_object_info = 1;\n \n \t\tif (repo_has_promisor_remote(the_repository))\n-\t\t\twarning(\"This repository uses promisor remotes. Some objects may not be loaded.\");\n+\t\t\twarning(\"this repository uses promisor remotes; some objects may not be loaded\");\n \n \t\tdisable_replace_refs();\n \ndiff --git a/t/t1006-cat-file.sh b/t/t1006-cat-file.sh\nindex 0eee3bb878..0283c7400d 100755\n--- a/t/t1006-cat-file.sh\n+++ b/t/t1006-cat-file.sh\n@@ -705,7 +705,7 @@ do\n \t\tthen\n \t\t\tcat >expect <<-EOF\n \t\t\terror: header for $bogus_long_oid too long, exceeds 32 bytes\n-\t\t\tfatal: Not a valid object name $bogus_long_oid\n+\t\t\tfatal: not a valid object name $bogus_long_oid\n \t\t\tEOF\n \t\telse\n \t\t\tcat >expect <<-EOF\n@@ -721,7 +721,7 @@ do\n \n \ttest_expect_success \"cat-file $arg1 error on missing short OID\" '\n \t\tcat >expect.err <<-EOF &&\n-\t\tfatal: Not a valid object name $(test_oid deadbeef_short)\n+\t\tfatal: not a valid object name $(test_oid deadbeef_short)\n \t\tEOF\n \t\ttest_must_fail git cat-file $arg1 $(test_oid deadbeef_short) >out 2>err.actual &&\n \t\ttest_must_be_empty out &&\n@@ -732,7 +732,7 @@ do\n \t\tif test \"$arg1\" = \"-p\"\n \t\tthen\n \t\t\tcat >expect.err <<-EOF\n-\t\t\tfatal: Not a valid object name $(test_oid deadbeef)\n+\t\t\tfatal: not a valid object name $(test_oid deadbeef)\n \t\t\tEOF\n \t\telse\n \t\t\tcat >expect.err <<-\\EOF\ndiff --git a/t/t8007-cat-file-textconv.sh b/t/t8007-cat-file-textconv.sh\nindex c3735fb50d..3a69b03794 100755\n--- a/t/t8007-cat-file-textconv.sh\n+++ b/t/t8007-cat-file-textconv.sh\n@@ -22,7 +22,7 @@ test_expect_success 'setup ' '\n \n test_expect_success 'usage: <bad rev>' '\n \tcat >expect <<-\\EOF &&\n-\tfatal: Not a valid object name HEAD2\n+\tfatal: not a valid object name HEAD2\n \tEOF\n \ttest_must_fail git cat-file --textconv HEAD2 2>actual &&\n \ttest_cmp expect actual\n\nbase-commit: 7c02d39fc2ed2702223c7674f73150d9a7e61ba4\n-- \ngitgitgadget\n"},{"id":"536818","messageId":"xmqqtsv7o3p1.fsf@gitster.g","threadId":"65046","inReplyTo":"pull.2052.git.1771836302101.gitgitgadget@gmail.com","subject":"Re: [PATCH] cat-file: fix error and warning message formatting","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-02-23T15:54:50Z","receivedAt":"2026-02-23T15:54:52Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Md Ferdous Alam via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> From: mdferdousalam <mdferdousalam1989@yahoo.com>\n>\n> The CodingGuidelines state that error messages should not begin\n> with a capital letter and should not end with a full stop.  Fix\n> the die(), error() and warning() messages in builtin/cat-file.c\n> that violate these rules, and update the corresponding test\n> expectations in t1006 and t8007.\n>\n> Signed-off-by: mdferdousalam <mdferdousalam1989@yahoo.com>\n> ---\n>     cat-file: fix error and warning message formatting\n>\n> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2052%2Fmdferdousalam%2Ffix-error-messages-cat-file-v1\n> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2052/mdferdousalam/fix-error-messages-cat-file-v1\n> Pull-Request: https://github.com/gitgitgadget/git/pull/2052\n\nIt may be cleaner to deal with \"Not a valid object name %s\" that\nappear in 5 other .c files in addition to cat-file.c in a single\npatch (touching no other messages, just the \"Not a valid object\nname\" one), and do the rest of cat-file.c in a second patch.\n\nHave you audited third-party software that use Git plumbing commands\nlike \"git cat-file\" to make sure that they do not expect the current\nand historical spelling to make sure this change will not break them?\n\nOther than that, looking good.  Thanks for working on it.\n\n>\n>  builtin/cat-file.c           | 8 ++++----\n>  t/t1006-cat-file.sh          | 6 +++---\n>  t/t8007-cat-file-textconv.sh | 2 +-\n>  3 files changed, 8 insertions(+), 8 deletions(-)\n>\n> diff --git a/builtin/cat-file.c b/builtin/cat-file.c\n> index df8e87a81f..a8d564dd6a 100644\n> --- a/builtin/cat-file.c\n> +++ b/builtin/cat-file.c\n> @@ -121,7 +121,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name)\n>  \n>  \tif (get_oid_with_context(the_repository, obj_name, get_oid_flags, &oid,\n>  \t\t\t\t &obj_context))\n> -\t\tdie(\"Not a valid object name %s\", obj_name);\n> +\t\tdie(\"not a valid object name %s\", obj_name);\n>  \n>  \tif (!path)\n>  \t\tpath = obj_context.path;\n> @@ -182,7 +182,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name)\n>  \tcase 'p':\n>  \t\ttype = odb_read_object_info(the_repository->objects, &oid, NULL);\n>  \t\tif (type < 0)\n> -\t\t\tdie(\"Not a valid object name %s\", obj_name);\n> +\t\t\tdie(\"not a valid object name %s\", obj_name);\n>  \n>  \t\t/* custom pretty-print here */\n>  \t\tif (type == OBJ_TREE) {\n> @@ -200,7 +200,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name)\n>  \t\tbuf = odb_read_object(the_repository->objects, &oid,\n>  \t\t\t\t      &type, &size);\n>  \t\tif (!buf)\n> -\t\t\tdie(\"Cannot read object %s\", obj_name);\n> +\t\t\tdie(\"cannot read object %s\", obj_name);\n>  \n>  \t\tif (use_mailmap) {\n>  \t\t\tsize_t s = size;\n> @@ -910,7 +910,7 @@ static int batch_objects(struct batch_options *opt)\n>  \t\t\tdata.skip_object_info = 1;\n>  \n>  \t\tif (repo_has_promisor_remote(the_repository))\n> -\t\t\twarning(\"This repository uses promisor remotes. Some objects may not be loaded.\");\n> +\t\t\twarning(\"this repository uses promisor remotes; some objects may not be loaded\");\n>  \n>  \t\tdisable_replace_refs();\n>  \n> diff --git a/t/t1006-cat-file.sh b/t/t1006-cat-file.sh\n> index 0eee3bb878..0283c7400d 100755\n> --- a/t/t1006-cat-file.sh\n> +++ b/t/t1006-cat-file.sh\n> @@ -705,7 +705,7 @@ do\n>  \t\tthen\n>  \t\t\tcat >expect <<-EOF\n>  \t\t\terror: header for $bogus_long_oid too long, exceeds 32 bytes\n> -\t\t\tfatal: Not a valid object name $bogus_long_oid\n> +\t\t\tfatal: not a valid object name $bogus_long_oid\n>  \t\t\tEOF\n>  \t\telse\n>  \t\t\tcat >expect <<-EOF\n> @@ -721,7 +721,7 @@ do\n>  \n>  \ttest_expect_success \"cat-file $arg1 error on missing short OID\" '\n>  \t\tcat >expect.err <<-EOF &&\n> -\t\tfatal: Not a valid object name $(test_oid deadbeef_short)\n> +\t\tfatal: not a valid object name $(test_oid deadbeef_short)\n>  \t\tEOF\n>  \t\ttest_must_fail git cat-file $arg1 $(test_oid deadbeef_short) >out 2>err.actual &&\n>  \t\ttest_must_be_empty out &&\n> @@ -732,7 +732,7 @@ do\n>  \t\tif test \"$arg1\" = \"-p\"\n>  \t\tthen\n>  \t\t\tcat >expect.err <<-EOF\n> -\t\t\tfatal: Not a valid object name $(test_oid deadbeef)\n> +\t\t\tfatal: not a valid object name $(test_oid deadbeef)\n>  \t\t\tEOF\n>  \t\telse\n>  \t\t\tcat >expect.err <<-\\EOF\n> diff --git a/t/t8007-cat-file-textconv.sh b/t/t8007-cat-file-textconv.sh\n> index c3735fb50d..3a69b03794 100755\n> --- a/t/t8007-cat-file-textconv.sh\n> +++ b/t/t8007-cat-file-textconv.sh\n> @@ -22,7 +22,7 @@ test_expect_success 'setup ' '\n>  \n>  test_expect_success 'usage: <bad rev>' '\n>  \tcat >expect <<-\\EOF &&\n> -\tfatal: Not a valid object name HEAD2\n> +\tfatal: not a valid object name HEAD2\n>  \tEOF\n>  \ttest_must_fail git cat-file --textconv HEAD2 2>actual &&\n>  \ttest_cmp expect actual\n>\n> base-commit: 7c02d39fc2ed2702223c7674f73150d9a7e61ba4\n"},{"id":"536867","messageId":"410509689.1055311.1771872851838@mail.yahoo.com","threadId":"65046","inReplyTo":"xmqqtsv7o3p1.fsf@gitster.g","subject":"Re: [PATCH] cat-file: fix error and warning message formatting","fromName":"Engr Md Ferdous Alam","fromEmail":"mdferdousalam1989@yahoo.com","sentAt":"2026-02-23T18:54:11Z","receivedAt":"2026-02-23T18:54:14Z","isPatch":true,"sender":{"key":"mdferdousalam1989@yahoo.com","avatar":null},"body":"\nJunio C Hamano <gitster@pobox.com> writes:\n\n\n> It may be cleaner to deal with \"Not a valid object name %s\" that\n> appear in 5 other .c files in addition to cat-file.c in a single\n> patch (touching no other messages, just the \"Not a valid object\n> name\" one), and do the rest of cat-file.c in a second patch.\n\n\nDone in v2.  The series is now split into two patches:\n\n\n  [1/2] die: lowercase \"Not a valid object name\" messages\n        (cat-file.c, describe.c, ls-tree.c, merge-base.c,\n         read-tree.c, unpack-file.c and their test expectations)\n  [2/2] cat-file: fix remaining error and warning message formatting\n        (\"Cannot read object\" and the promisor remotes warning)\n\n\n> Have you audited third-party software that use Git plumbing commands\n> like \"git cat-file\" to make sure that they do not expect the current\n> and historical spelling to make sure this change will not break them?\n\n\nI did a broad search across GitHub.  Here is what I found:\n\n\nSeveral widely-used projects do case-sensitive string matching on\n\"fatal: Not a valid object name\" in stderr output from Git commands:\n\n\n  - Gitea (go-gitea/gitea) -- strings.Contains() in Go\n  - Gogs (gogs/gogs) -- strings.Contains() in Go\n  - GitLab Gitaly -- strings.HasPrefix() in Go\n  - JetBrains IntelliJ -- startsWith() in Java\n  - Harness CI/CD -- strings.HasPrefix() in Go (3 locations)\n  - Review Board -- startswith() in Python\n  - Tencent CodeAnalysis -- regex match in Python\n  - DataLad -- \"in\" string check in Python\n  - elastic/docs tooling -- .includes() in JavaScript\n  - prettier-standard -- exact === equality in JavaScript\n\n\nOn the other hand, these are NOT affected:\n\n\n  - Pure Git reimplementations (libgit2, JGit, go-git, Dulwich,\n    isomorphic-git, GitPython) generate their own messages.\n  - GitKraken GitLens already uses case-insensitive matching (/i).\n  - VS Code Git extension and GitHub Desktop do not match this\n    specific message.\n  - Many CI/CD tools (Nx, BuildKit, Skaffold, Flutter) rely on\n    exit codes rather than message text.\n\n\nA handful of projects already check for the lowercase form \"not a\nvalid object name\", suggesting the ecosystem is in transition, but\nthe majority still expect the capitalized form.\n\n\nGiven the risk of silently breaking error detection in projects like\nGitea, Gogs, Gitaly, and IntelliJ, I am not sure whether it is\nworth proceeding with patch [1/2].  Patch [2/2] changes messages\nthat are far less likely to be parsed by external tools (\"Cannot\nread object\" and the promisor remotes warning).\n\n\nHow would you like to proceed?  Should we:\n\n\n  (a) keep both patches as-is and let downstream projects adapt,\n  (b) drop patch [1/2] and only ship [2/2], or\n  (c) take a different approach?\n\n\nThanks,\nMd Ferdous Alam\n\n  \n\n\n\n\n\n\n\nOn Monday, February 23, 2026 at 09:54:52 PM GMT+6, Junio C Hamano <gitster@pobox.com> wrote: \n\n\n\n\n\n\"Md Ferdous Alam via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> From: mdferdousalam <mdferdousalam1989@yahoo.com>\n>\n> The CodingGuidelines state that error messages should not begin\n> with a capital letter and should not end with a full stop.  Fix\n> the die(), error() and warning() messages in builtin/cat-file.c\n> that violate these rules, and update the corresponding test\n> expectations in t1006 and t8007.\n>\n> Signed-off-by: mdferdousalam <mdferdousalam1989@yahoo.com>\n> ---\n>    cat-file: fix error and warning message formatting\n>\n> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2052%2Fmdferdousalam%2Ffix-error-messages-cat-file-v1\n> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2052/mdferdousalam/fix-error-messages-cat-file-v1\n> Pull-Request: https://github.com/gitgitgadget/git/pull/2052\n\nIt may be cleaner to deal with \"Not a valid object name %s\" that\nappear in 5 other .c files in addition to cat-file.c in a single\npatch (touching no other messages, just the \"Not a valid object\nname\" one), and do the rest of cat-file.c in a second patch.\n\nHave you audited third-party software that use Git plumbing commands\nlike \"git cat-file\" to make sure that they do not expect the current\nand historical spelling to make sure this change will not break them?\n\nOther than that, looking good.  Thanks for working on it.\n\n\n>\n>  builtin/cat-file.c          | 8 ++++----\n>  t/t1006-cat-file.sh          | 6 +++---\n>  t/t8007-cat-file-textconv.sh | 2 +-\n>  3 files changed, 8 insertions(+), 8 deletions(-)\n>\n> diff --git a/builtin/cat-file.c b/builtin/cat-file.c\n> index df8e87a81f..a8d564dd6a 100644\n> --- a/builtin/cat-file.c\n> +++ b/builtin/cat-file.c\n> @@ -121,7 +121,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name)\n>  \n>      if (get_oid_with_context(the_repository, obj_name, get_oid_flags, &oid,\n>                  &obj_context))\n> -        die(\"Not a valid object name %s\", obj_name);\n> +        die(\"not a valid object name %s\", obj_name);\n>  \n>      if (!path)\n>          path = obj_context.path;\n> @@ -182,7 +182,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name)\n>      case 'p':\n>          type = odb_read_object_info(the_repository->objects, &oid, NULL);\n>          if (type < 0)\n> -            die(\"Not a valid object name %s\", obj_name);\n> +            die(\"not a valid object name %s\", obj_name);\n>  \n>          /* custom pretty-print here */\n>          if (type == OBJ_TREE) {\n> @@ -200,7 +200,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name)\n>          buf = odb_read_object(the_repository->objects, &oid,\n>                        &type, &size);\n>          if (!buf)\n> -            die(\"Cannot read object %s\", obj_name);\n> +            die(\"cannot read object %s\", obj_name);\n>  \n>          if (use_mailmap) {\n>              size_t s = size;\n> @@ -910,7 +910,7 @@ static int batch_objects(struct batch_options *opt)\n>              data.skip_object_info = 1;\n>  \n>          if (repo_has_promisor_remote(the_repository))\n> -            warning(\"This repository uses promisor remotes. Some objects may not be loaded.\");\n> +            warning(\"this repository uses promisor remotes; some objects may not be loaded\");\n>  \n>          disable_replace_refs();\n>  \n> diff --git a/t/t1006-cat-file.sh b/t/t1006-cat-file.sh\n> index 0eee3bb878..0283c7400d 100755\n> --- a/t/t1006-cat-file.sh\n> +++ b/t/t1006-cat-file.sh\n> @@ -705,7 +705,7 @@ do\n>          then\n>              cat >expect <<-EOF\n>              error: header for $bogus_long_oid too long, exceeds 32 bytes\n> -            fatal: Not a valid object name $bogus_long_oid\n> +            fatal: not a valid object name $bogus_long_oid\n>              EOF\n>          else\n>              cat >expect <<-EOF\n> @@ -721,7 +721,7 @@ do\n>  \n>      test_expect_success \"cat-file $arg1 error on missing short OID\" '\n>          cat >expect.err <<-EOF &&\n> -        fatal: Not a valid object name $(test_oid deadbeef_short)\n> +        fatal: not a valid object name $(test_oid deadbeef_short)\n>          EOF\n>          test_must_fail git cat-file $arg1 $(test_oid deadbeef_short) >out 2>err.actual &&\n>          test_must_be_empty out &&\n> @@ -732,7 +732,7 @@ do\n>          if test \"$arg1\" = \"-p\"\n>          then\n>              cat >expect.err <<-EOF\n> -            fatal: Not a valid object name $(test_oid deadbeef)\n> +            fatal: not a valid object name $(test_oid deadbeef)\n>              EOF\n>          else\n>              cat >expect.err <<-\\EOF\n> diff --git a/t/t8007-cat-file-textconv.sh b/t/t8007-cat-file-textconv.sh\n> index c3735fb50d..3a69b03794 100755\n> --- a/t/t8007-cat-file-textconv.sh\n> +++ b/t/t8007-cat-file-textconv.sh\n> @@ -22,7 +22,7 @@ test_expect_success 'setup ' '\n>  \n>  test_expect_success 'usage: <bad rev>' '\n>      cat >expect <<-\\EOF &&\n> -    fatal: Not a valid object name HEAD2\n> +    fatal: not a valid object name HEAD2\n>      EOF\n>      test_must_fail git cat-file --textconv HEAD2 2>actual &&\n>      test_cmp expect actual\n>\n> base-commit: 7c02d39fc2ed2702223c7674f73150d9a7e61ba4\n"},{"id":"536880","messageId":"xmqqms0zmdt3.fsf@gitster.g","threadId":"65046","inReplyTo":"410509689.1055311.1771872851838@mail.yahoo.com","subject":"Re: [PATCH] cat-file: fix error and warning message formatting","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-02-23T19:59:20Z","receivedAt":"2026-02-23T19:59:23Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Engr Md Ferdous Alam <mdferdousalam1989@yahoo.com> writes:\n\n> Given the risk of silently breaking error detection in projects like\n> Gitea, Gogs, Gitaly, and IntelliJ, I am not sure whether it is\n> worth proceeding with patch [1/2].\n> ...\n> How would you like to proceed?\n\nIt is prudent to treat any and all messages from plumbing commands\nlike cat-file as sleeping dogs and keep them undisturbed.  Even for\nhuman end-user facing messages from Porcelain commands, we may want\nto be careful, but if I recall correctly, the commands your recent\nset of patches covered were all plumbing?\n\nThanks.\n"}]}