aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fsck.c20
-rwxr-xr-xt/t1450-fsck.sh4
2 files changed, 22 insertions, 2 deletions
diff --git a/fsck.c b/fsck.c
index e6e8dc4c9..4748f1e23 100644
--- a/fsck.c
+++ b/fsck.c
@@ -189,6 +189,24 @@ void fsck_set_msg_types(struct fsck_options *options, const char *values)
free(to_free);
}
+static void append_msg_id(struct strbuf *sb, const char *msg_id)
+{
+ for (;;) {
+ char c = *(msg_id)++;
+
+ if (!c)
+ break;
+ if (c != '_')
+ strbuf_addch(sb, tolower(c));
+ else {
+ assert(*msg_id);
+ strbuf_addch(sb, *(msg_id)++);
+ }
+ }
+
+ strbuf_addstr(sb, ": ");
+}
+
__attribute__((format (printf, 4, 5)))
static int report(struct fsck_options *options, struct object *object,
enum fsck_msg_id id, const char *fmt, ...)
@@ -197,6 +215,8 @@ static int report(struct fsck_options *options, struct object *object,
struct strbuf sb = STRBUF_INIT;
int msg_type = fsck_msg_type(id, options), result;
+ append_msg_id(&sb, msg_id_info[id].id_string);
+
va_start(ap, fmt);
strbuf_vaddf(&sb, fmt, ap);
result = options->error_func(object, msg_type, sb.buf);
diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh
index cfb32b624..7c5b3d518 100755
--- a/t/t1450-fsck.sh
+++ b/t/t1450-fsck.sh
@@ -231,8 +231,8 @@ test_expect_success 'tag with incorrect tag name & missing tagger' '
git fsck --tags 2>out &&
cat >expect <<-EOF &&
- warning in tag $tag: invalid '\''tag'\'' name: wrong name format
- warning in tag $tag: invalid format - expected '\''tagger'\'' line
+ warning in tag $tag: badTagName: invalid '\''tag'\'' name: wrong name format
+ warning in tag $tag: missingTaggerEntry: invalid format - expected '\''tagger'\'' line
EOF
test_cmp expect out
'