Re: [PATCH v2 1/4] t/unit-tests: implement clar specific oid helper functions
- From
Seyi Chamber <kuforiji98@gmail.com>
- Date
- Feb 25, 2025, 07:14 UTC
- Message-ID
- <CAGedMteOTewr9=m6=5NztLA_cDiuq=uEt-A26rFWRCmEw0=_UA@mail.gmail.com>
- In-Reply-To
- <xmqqwmdf5is1.fsf@gitster.g>
On Mon, 24 Feb 2025 at 18:56, Junio C Hamano <gitster@pobox.com> wrote:
Show 34 quoted lines
>
> Seyi Kuforiji <kuforiji98@gmail.com> writes:
>
> > -static int get_oid_arbitrary_hex_algop(const char *hex, struct object_id *oid,
> > +static void cl_parse_oid(const char *hex, struct object_id *oid,
> > const struct git_hash_algo *algop)
> > {
> > int ret;
> > size_t sz = strlen(hex);
> > struct strbuf buf = STRBUF_INIT;
> >
> > - if (!check(sz <= algop->hexsz)) {
> > - test_msg("BUG: hex string (%s) bigger than maximum allowed (%lu)",
> > - hex, (unsigned long)algop->hexsz);
> > - return -1;
> > - }
> > + cl_assert(sz <= algop->hexsz);
> >
> > strbuf_add(&buf, hex, sz);
> > strbuf_addchars(&buf, '0', algop->hexsz - sz);
> >
> > - ret = get_oid_hex_algop(buf.buf, oid, algop);
> > - if (!check_int(ret, ==, 0))
> > - test_msg("BUG: invalid hex input (%s) provided", hex);
> > + cl_assert_equal_i(get_oid_hex_algop(buf.buf, oid, algop), 0);
> >
> > strbuf_release(&buf);
> > - return ret;
> > }
>
> As you are not returning "ret" and making the function void, you
> made "int ret" an unused variable that needs removing.
>
> Thanks.Hi Junio,
Do I send in a new patch series addressing this?
Thanks, Seyi