Re: [PATCH v14 12/27] bisect--helper: `get_terms` & `bisect_terms` shell function in C
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 25, 2016, 18:05 UTC
- Message-ID
- <xmqqmvk0n2pl.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <01020156b73fe6b3-3ccd9de5-604d-4e7d-919d-a3adae869ebf-000000@eu-west-1.amazonses.com>
Pranit Bauva <pranit.bauva@gmail.com> writes:
Show 26 quoted lines
> +static int bisect_terms(struct bisect_terms *terms, const char **argv, int argc)
> +{
> + int i;
> +
> + if (get_terms(terms)) {
> + fprintf(stderr, _("no terms defined\n"));
> + return -1;
> + }
> + if (argc == 0) {
> + printf(_("Your current terms are %s for the old state\nand "
> + "%s for the new state.\n"), terms->term_good.buf,
> + terms->term_bad.buf);
> + return 0;
> + }
> +
> + for (i = 0; i < argc; i++) {
> + if (!strcmp(argv[i], "--term-good"))
> + printf("%s\n", terms->term_good.buf);
> + else if (!strcmp(argv[i], "--term-bad"))
> + printf("%s\n", terms->term_bad.buf);
> + else
> + printf(_("invalid argument %s for 'git bisect "
> + "terms'.\nSupported options are: "
> + "--term-good|--term-old and "
> + "--term-bad|--term-new."), argv[i]);
> + }The original took only one and gave one answer (and errored out when the user asked for more), but this one loops. I can see either way is OK and do not think of a good reason to favor one over the other; unless there is a strong reason why you need this extended behaviour that allows users to ask multiple questions, I'd say we should keep the original behaviour.