Subject: Re: [PATCH v4 5/8] list-objects: implement object type filter

From: Ævar Arnfjörð Bjarmason <[email-masked]>
Date: Tue, 13 Apr 2021 11:57:04 +0200

On Mon, Apr 12 2021, Patrick Steinhardt wrote:

> +	} else if (skip_prefix(arg, "object:type=", &v0)) {
> +		int type = type_from_string_gently(v0, -1, 1);
> +		if (type < 0) {
> +			strbuf_addstr(errbuf, _("expected 'object:type=<type>'"));

Maybe:

	strbuf_addstr(errbuf, _("'%s' for 'object:type=<type>' is not a valid object type"), v0);

> +# Test object:type=<type> filter.
> +
> +test_expect_success 'setup object-type' '
> +	git init object-type &&
> +	echo contents >object-type/blob &&
> +	git -C object-type add blob &&
> +	git -C object-type commit -m commit-message &&
> +	git -C object-type tag tag -m tag-message
> +'

Does this really need to not be the shorter:

    test_create_repo object-type &&
    test_commit -C object-type blob

Or if it really needs the annotated tag maybe that + --no-tag + create
the tag after, and it can eventually use my
https://lore.kernel.org/git/[email-masked]/

> +test_expect_success 'verify object:type=blob prints blob and commit' '
> +	(
> +		git -C object-type rev-parse HEAD &&
> +		printf "%s blob\n" $(git -C object-type rev-parse HEAD:blob)
> +	) >expected &&

Just use > and >> or a single printf with two arguments instead of a
subshell?