From: karthik nayak <karthik.188@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, sunshine@sunshineco.com
Subject: Re: [PATCH v9 1/5] sha1_file: support reading from a loose object of unknown type
Date: Thu, 30 Apr 2015 10:10:11 +0530 [thread overview]
Message-ID: <5541B22B.6040403@gmail.com> (raw)
In-Reply-To: <xmqq383i6849.fsf@gitster.dls.corp.google.com>
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 :)
next prev parent reply other threads:[~2015-04-30 4:40 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-29 12:50 [PATCH v9 0/5] cat-file: teach cat-file a '--allow-unkown-type' option karthik nayak
2015-04-29 12:52 ` [PATCH v9 1/5] sha1_file: support reading from a loose object of unknown type Karthik Nayak
2015-04-29 14:49 ` Junio C Hamano
2015-04-29 17:50 ` karthik nayak
2015-04-29 19:35 ` Junio C Hamano
2015-04-30 4:40 ` karthik nayak [this message]
2015-04-29 12:52 ` [PATCH v9 2/5] cat-file: make the options mutually exclusive Karthik Nayak
2015-04-29 12:53 ` [PATCH v9 3/5] cat-file: teach cat-file a '--allow-unknown-type' option Karthik Nayak
2015-04-29 14:52 ` Junio C Hamano
2015-04-29 17:43 ` karthik nayak
2015-04-29 14:53 ` Phil Hord
2015-04-29 17:44 ` karthik nayak
2015-04-29 19:38 ` Junio C Hamano
2015-04-29 12:54 ` [PATCH v9 5/5] t1006: add tests for git cat-file --allow-unkown-type Karthik Nayak
2015-04-29 21:16 ` Eric Sunshine
2015-04-29 12:56 ` [PATCH v9 4/5] cat-file: add documentation for '--allow-unkown-type' option Karthik Nayak
2015-04-29 21:13 ` Eric Sunshine
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5541B22B.6040403@gmail.com \
--to=karthik.188@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=sunshine@sunshineco.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).