Re: [PATCH v7 7/7] list-objects-filter: implement filter tree:0
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 4, 2018, 20:44 UTC
- Message-ID
- <xmqqwos16li9.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <956f0c704f5492680928f4dc9ce9411e7f80bba4.1536081438.git.matvore@google.com>
Matthew DeVore <matvore@google.com> writes:
Show 8 quoted lines
> @@ -50,6 +50,10 @@ static int gently_parse_list_objects_filter(
> return 0;
> }
>
> + } else if (!strcmp(arg, "tree:0")) {
> + filter_options->choice = LOFC_TREE_NONE;
> + return 0;
> +This is not wrong per-se, but I would have expected to see something like:
... else if (skip_prefix(arg, "tree:", ¶m)) {
unsigned long depth;
if (!git_parse_ulong(param, &depth) || depth != 0) {
err = "only 'tree:0' is supported";
return -1;
}
filter_options->choice = LOFC_TREE_NONE;
return 0;so that "tree:1" is rejected not with "invalid filter-spec" but a bit more descriptive "only tree:0 is". Accepting "tree:00" or "tree:0k" is merely an added bogus^wbonus.