Re: [PATCH] credential: parse subcommands with OPT_SUBCOMMAND
- From
- Tanga Joris <tangajoris@gmail.com>
- Date
- Nov 8, 2026, 22:28 UTC
- Message-ID
- <CAKrRMNqsh=d+_C8u+q1EBeQVwDZaywGQGZ89oYLyyvmB=8u1jw@mail.gmail.com>
- In-Reply-To
- <20261104202228.24642-1-edsonwasswa54@gmail.com>
Hi Edson,
Thanks for working on this, nice work adding subcommands completion for "git credential".
On Thu, 5 Nov 2026 at 03:59, Wasswa Edson <edsonwasswa54@gmail.com> wrote:
> Besides making the code > shorter and more idiomatic,
builtin/credential.c goes from 52 lines to 140, so maybe "shorter" could go.
Overall, the patch looks good, but most of the new lines are the same parse_options() call and check, repeated four times. Maybe a small helper would work here?
> + if (argc) > + usage_with_options(credential_fill_usage, options);
One small thing: no test covers this check. When I removed it, t0300 still passed. Maybe something like this?
test_expect_success 'credential subcommands reject extra arguments' '
for sub in fill approve reject capability
do
test_expect_code 129 git credential $sub extra
</dev/null || return 1
done
'Thanks, Tanga