diff --git a/fsck.c b/fsck.c index 2fffa434a5..88c92e82d1 100644 --- a/fsck.c +++ b/fsck.c @@ -423,7 +423,8 @@ static int fsck_tag_buffer(struct tag *tag, const char *data, } strbuf_addf(&sb, "refs/tags/%.*s", (int)(eol - buffer), buffer); if (check_refname_format(sb.buf, 0)) - error_func(&tag->object, FSCK_WARN, "invalid 'tag' name: %s", buffer); + error_func(&tag->object, FSCK_WARN, "invalid 'tag' name: %.*s", + (int)(eol - buffer), buffer); buffer = eol + 1; if (!skip_prefix(buffer, "tagger ", &buffer)) diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh index 1b96b4045b..7850607783 100755 --- a/t/t1450-fsck.sh +++ b/t/t1450-fsck.sh @@ -209,8 +209,12 @@ test_expect_success 'tag with incorrect tag name & missing tagger' ' echo $tag >.git/refs/tags/wrong && test_when_finished "git update-ref -d refs/tags/wrong" && git fsck --tags 2>out && - grep "invalid .tag. name" out && - grep "expected .tagger. line" out + + cat >expect <<-EOF && + warning in tag $tag: invalid '\''tag'\'' name: wrong name format + warning in tag $tag: invalid format - expected '\''tagger'\'' line + EOF + test_cmp expect out ' test_expect_success 'cleaned up' '