On Tue, Nov 6, 2018 at 4:41 AM Junio C Hamano <gitster@xxxxxxxxx> wrote: > > static int fsck_error_func(struct fsck_options *o, > > struct object *obj, int type, const char *message) > > { > > - objreport(obj, (type == FSCK_WARN) ? "warning" : "error", message); > > - return (type == FSCK_WARN) ? 0 : 1; > > + if (type == FSCK_WARN) { > > + fprintf_ln(stderr, "warning in %s %s: %s", > > + printable_type(obj), describe_object(obj), message); > > + return 0; > > + } > > + > > + fprintf_ln(stderr, "error in %s %s: %s", > > + printable_type(obj), describe_object(obj), message); > > + return 1; > > Make it look more symmetrical like the original, perhaps by > > if (type == FSCK_WARN) { > ... > return 0; > } else { /* FSCK_ERROR */ > ... > return 1; > } > > Actually, wouldn't it be clearer to see what is going on, if we did > it like this instead? > > const char *fmt = (type == FSCK_WARN) > ? N_("warning in %s %s: %s") > : N_("error in %s %s: %s"); > fprintf_ln(stderr, _(fmt), > printable_type(obj), describe_object(obj), message); > return (type == FSCK_WARN) ? 0 : 1; > > It would show that in either case we show these three things in the > message. I dunno. Specifying "type == FSCK_WARN" twice triggers me (what if we add a third fsck type?) so I just turn this to a switch/case block instead (and get to know the third fsck type FSCK_IGNORE). -- Duy