Re: [RFC/PATCH 4/9] parse-options: add parse_opt_merge_filter()
- From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
- Date
- Jun 8, 2015, 17:58 UTC
- Message-ID
- <vpqoakqozdr.fsf@anie.imag.fr>
- In-Reply-To
- <1433621052-5588-4-git-send-email-karthik.188@gmail.com>
Karthik Nayak <karthik.188@gmail.com> writes:
Show 8 quoted lines
> +int parse_opt_merge_filter(const struct option *opt, const char *arg, int unset)
> +{
> + struct ref_filter *rf = opt->value;
> + unsigned char sha1[20];
> +
> + rf->merge = opt->long_name[0] == 'n'
> + ? REF_FILTER_MERGED_OMIT
> + : REF_FILTER_MERGED_INCLUDE;I would use starts_with("no-", opt->long_name) instead. I had a hard time understanding why the letter 'n' was special while the starts_with() version is self-explanatory.
-- Matthieu Moy http://www-verimag.imag.fr/~moy/