git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] credential: parse subcommands with OPT_SUBCOMMAND

From
TJTanga 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

Previous: Wasswa EdsonNext: Wasswa Edson
Message 2 of 6 in “credential: parse subcommands with OPT_SUBCOMMAND”
  1. credential: parse subcommands with OPT_SUBCOMMANDWasswa Edson, Nov 4, 2026
  2. Tanga JorisNov 8, 2026
  3. 0/3 credential: parse subcommands with OPT_SUBCOMMANDWasswa Edson, Nov 14, 2026
  4. 1/3 credential: make -h output and SYNOPSIS agreeWasswa Edson, Nov 14, 2026
  5. 2/3 credential: move each subcommand into its own functionWasswa Edson, Nov 14, 2026
  6. 3/3 credential: parse subcommands with OPT_SUBCOMMANDWasswa Edson, Nov 14, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.