Re: [PATCH v6 05/13] git.c: convert --list-* to --list-cmds=*
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 8, 2018, 03:50 UTC
- Message-ID
- <xmqqin7yn6us.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <20180507175222.12114-6-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:
Show 8 quoted lines
> Even if these are hidden options, let's make them a bit more generic > since we're introducing more listing types shortly. The code is > structured to allow combining multiple listing types together because > we will soon add more types the 'builtins'. > > 'parseopt' remains separate because it has separate (SPC) to match > git-completion.bash needs and will not combine with others. > ---
Missing sign-off.
Show 8 quoted lines
> +static int list_cmds(const char *spec)
> +{
> + while (*spec) {
> + const char *sep = strchrnul(spec, ',');
> + int len = sep - spec;
> +
> + if (len == 8 && !strncmp(spec, "builtins", 8))
> + list_builtins(0, '\n');This is the origin of ugliness we see in later steps that follow the same
if (len == strlen(constS) && !strncmp(spec, constS, strlen(constS))
pattern added here. Could we have a small helper that takes len, spec, and constS to abstract "8" away?