[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git
Subject:    Re: [PATCH v9 1/5] sha1_file: support reading from a loose object of unknown type
From:       karthik nayak <karthik.188 () gmail ! com>
Date:       2015-04-30 4:52:11
Message-ID: 5541B22B.6040403 () gmail ! com
[Download RAW message or body]


On 04/30/2015 01:05 AM, Junio C Hamano wrote:
> karthik nayak <karthik.188@gmail.com> writes:
>
> > On 04/29/2015 08:19 PM, Junio C Hamano wrote:
> >> Karthik Nayak <karthik.188@gmail.com> 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).
Thanks for clearing that out.
>
> >> 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.
>
Yup will do :)
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic