karthik nayak <karthik.188@xxxxxxxxx> writes: > On 04/29/2015 08:19 PM, Junio C Hamano wrote: >> Karthik Nayak <karthik.188@xxxxxxxxx> writes: >> >>> Update sha1_loose_object_info() to optionally allow it to read >>> from a loose object file of unknown/bogus type; as the function >>> usually returns the type of the object it read in the form of enum >>> for known types, add an optional "typename" field to receive the >>> name of the type in textual form and a flag to indicate the reading >>> of a loose object file of unknown/bogus type. >>> >>> Add parse_sha1_header_extended() which acts as a wrapper around >>> parse_sha1_header() allowing more information to be obtained. >> >> Thanks. This mostly looks good modulo a nit. > > Sorry didn't get what you meant by "modulo a nit.". "nit" as in "Nit-pick"; a small imperfection that may need to be corrected (such as the "what if we saw failure earlier and 'status' already had a value?" issue). >> It is a good trade-off between complexity and efficiency. The >> complexity is isolated as the function is file-scope-static and it >> is perfectly fine to force the callers to be extra careful. >> >> But this suggests that the patch to add tests should try at least >> two, preferably three, kinds of test input. A bogus type that needs >> a header longer than the caller's fixed buffer, a bogus type whose >> header would fit within the fixed buffer, and optionally a correct >> type whose header should always fit within the fixed buffer. > > Yes it is a tradeoff, and it is complex as in the user has to check > the strbuf provided to see if its been used. But this like you said I > guess its a good tradeoff. > About the three tests, My patch checks "a bogus type whose header > would fit within the fixed buffer" and "correct type whose header > should always fit within the fixed buffer" but will write a test to > check "A bogus type that needs a header longer than the caller's fixed > buffer" Yup. Please do so; that would make the test coverage more complete. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html