path: root/builtin/fsck.c
diff options
authorÆvar Arnfjörð Bjarmason <>2021-03-28 13:15:46 (GMT)
committerJunio C Hamano <>2021-03-29 02:03:10 (GMT)
commit394d5d31b0d3096aed4513bdacf48fb73003f1df (patch)
tree9860250512b34cc93a11be0da1540ddbe1e0f3f7 /builtin/fsck.c
parent44e07da8bb346c203246eae4f1a498844ee6d1ba (diff)
fsck.c: pass along the fsck_msg_id in the fsck_error callback
Change the fsck_error callback to also pass along the fsck_msg_id. Before this change the only way to get the message id was to parse it back out of the "message". Let's pass it down explicitly for the benefit of callers that might want to use it, as discussed in [1]. Passing the msg_type is now redundant, as you can always get it back from the msg_id, but I'm not changing that convention. It's really common to need the msg_type, and the report() function itself (which calls "fsck_error") needs to call fsck_msg_type() to discover it. Let's not needlessly re-do that work in the user callback. 1. Signed-off-by: Ævar Arnfjörð Bjarmason <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'builtin/fsck.c')
1 files changed, 3 insertions, 1 deletions
diff --git a/builtin/fsck.c b/builtin/fsck.c
index 17940a4..70ff958 100644
--- a/builtin/fsck.c
+++ b/builtin/fsck.c
@@ -84,7 +84,9 @@ static int objerror(struct object *obj, const char *err)
static int fsck_error_func(struct fsck_options *o,
const struct object_id *oid,
enum object_type object_type,
- enum fsck_msg_type msg_type, const char *message)
+ enum fsck_msg_type msg_type,
+ enum fsck_msg_id msg_id,
+ const char *message)
switch (msg_type) {