> +char* oid_is_type_or_die_msg(const struct object_id *oid, > + enum object_type want, > + enum object_type *type) > +{ > + struct strbuf sb = STRBUF_INIT; > + if (want == *type) > + BUG("call this just to get the message!"); > + strbuf_addf(&sb, _(object_type_mismatch_msg), oid_to_hex(oid), > + type_name(*type), type_name(want)); > + return strbuf_detach(&sb, NULL); > +} It would be more convenient for the caller if this function also checks want vs type and returns NULL if they match. That would also be more consistent with the other functions, and the caller wouldn't need to remember that this function only works if want and type are different.