Skip to content

Commit 03d3eaa

Browse files
committed
cat-file: fix 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 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>
1 parent 7c02d39 commit 03d3eaa

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

builtin/cat-file.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name)
121121

122122
if (get_oid_with_context(the_repository, obj_name, get_oid_flags, &oid,
123123
&obj_context))
124-
die("Not a valid object name %s", obj_name);
124+
die("not a valid object name %s", obj_name);
125125

126126
if (!path)
127127
path = obj_context.path;
@@ -182,7 +182,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name)
182182
case 'p':
183183
type = odb_read_object_info(the_repository->objects, &oid, NULL);
184184
if (type < 0)
185-
die("Not a valid object name %s", obj_name);
185+
die("not a valid object name %s", obj_name);
186186

187187
/* custom pretty-print here */
188188
if (type == OBJ_TREE) {
@@ -200,7 +200,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name)
200200
buf = odb_read_object(the_repository->objects, &oid,
201201
&type, &size);
202202
if (!buf)
203-
die("Cannot read object %s", obj_name);
203+
die("cannot read object %s", obj_name);
204204

205205
if (use_mailmap) {
206206
size_t s = size;
@@ -910,7 +910,7 @@ static int batch_objects(struct batch_options *opt)
910910
data.skip_object_info = 1;
911911

912912
if (repo_has_promisor_remote(the_repository))
913-
warning("This repository uses promisor remotes. Some objects may not be loaded.");
913+
warning("this repository uses promisor remotes; some objects may not be loaded");
914914

915915
disable_replace_refs();
916916

t/t1006-cat-file.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ do
705705
then
706706
cat >expect <<-EOF
707707
error: header for $bogus_long_oid too long, exceeds 32 bytes
708-
fatal: Not a valid object name $bogus_long_oid
708+
fatal: not a valid object name $bogus_long_oid
709709
EOF
710710
else
711711
cat >expect <<-EOF
@@ -721,7 +721,7 @@ do
721721

722722
test_expect_success "cat-file $arg1 error on missing short OID" '
723723
cat >expect.err <<-EOF &&
724-
fatal: Not a valid object name $(test_oid deadbeef_short)
724+
fatal: not a valid object name $(test_oid deadbeef_short)
725725
EOF
726726
test_must_fail git cat-file $arg1 $(test_oid deadbeef_short) >out 2>err.actual &&
727727
test_must_be_empty out &&
@@ -732,7 +732,7 @@ do
732732
if test "$arg1" = "-p"
733733
then
734734
cat >expect.err <<-EOF
735-
fatal: Not a valid object name $(test_oid deadbeef)
735+
fatal: not a valid object name $(test_oid deadbeef)
736736
EOF
737737
else
738738
cat >expect.err <<-\EOF

t/t8007-cat-file-textconv.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ test_expect_success 'setup ' '
2222

2323
test_expect_success 'usage: <bad rev>' '
2424
cat >expect <<-\EOF &&
25-
fatal: Not a valid object name HEAD2
25+
fatal: not a valid object name HEAD2
2626
EOF
2727
test_must_fail git cat-file --textconv HEAD2 2>actual &&
2828
test_cmp expect actual

0 commit comments

Comments
 (0)