Johannes Schindelin <Johannes.Schindelin@xxxxxx> writes: >> > + if (type != OBJ_BLOB) { >> > + free(*buf); >> > + return error(_("blob expected for %s '%s'"), >> > + sha1_to_hex(sha1), path); >> > + } >> > + if (S_ISREG(mode)) { >> > + struct strbuf strbuf = STRBUF_INIT; >> > + if (convert_to_working_tree(path, *buf, *size, &strbuf)) { >> > + free(*buf); >> > + *size = strbuf.len; >> > + *buf = strbuf_detach(&strbuf, NULL); >> > + } >> > + } >> >> This needs to error out when mode is not ISREG just like it errors >> out when type is not BLOB. > > Are you sure that this is desirable in batch mode? I do not quite see a reason why we should not diagnose a bad input that does not produce a filtered result. In batch mode or not, it diagnoses when the user feeds it a non-blob, and I think it should do so for non-regular, too. Both are "you asked me to filter, but you shouldn't have".