From: Junio C Hamano <gitster@pobox.com>
To: Alex Henrie <alexhenrie24@gmail.com>
Cc: git@vger.kernel.org, tao@klerks.biz, newren@gmail.com,
phillip.wood123@gmail.com, Johannes.Schindelin@gmx.de
Subject: Re: [PATCH v3 3/3] rebase: add a config option for --rebase-merges
Date: Wed, 22 Feb 2023 16:12:05 -0800 [thread overview]
Message-ID: <xmqqh6vdb5pm.fsf@gitster.g> (raw)
In-Reply-To: <20230222051709.464275-3-alexhenrie24@gmail.com> (Alex Henrie's message of "Tue, 21 Feb 2023 22:17:09 -0700")
Alex Henrie <alexhenrie24@gmail.com> writes:
> +rebase.merges::
> + Whether and how to set the `--rebase-merges` option by default. Can
> + be `rebase-cousins`, `no-rebase-cousins`, or a boolean. Setting to
> + true is equivalent to `--rebase-merges` without an argument, setting to
> + `rebase-cousins` or `no-rebase-cousins` is equivalent to
> + `--rebase-merges` with that value as its argument, and setting to false
> + is equivalent to `--no-rebase-merges`. Passing `--rebase-merges` on the
> + command line without an argument overrides a `rebase.merges=false`
> + configuration but does not override other values of `rebase.merge`.
OK. And ...
> +static void parse_merges_value(struct rebase_options *options, const char *value)
> +{
> + if (value) {
> + if (!strcmp("no-rebase-cousins", value))
> + options->rebase_cousins = 0;
> + else if (!strcmp("rebase-cousins", value))
> + options->rebase_cousins = 1;
> + else
> + die(_("Unknown mode: %s"), value);
> + }
> +
> + options->rebase_merges = 1;
> +}
... this fallback parsing that is called after parse_maybe_bool()
finds the value a non-Boolean ...
> @@ -815,6 +829,13 @@ static int rebase_config(const char *var, const char *value, void *data)
> return 0;
> }
>
> + if (!strcmp(var, "rebase.merges") && value && *value) {
> + opts->rebase_merges = git_parse_maybe_bool(value);
> + if (opts->rebase_merges < 0)
> + parse_merges_value(opts, value);
> + return 0;
> + }
... looks pretty much standard way to handle such an "extended
Boolean" value. Nicely done.
prev parent reply other threads:[~2023-02-23 0:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-22 5:17 [PATCH v3 1/3] rebase: add documentation and tests for --no-rebase-merges Alex Henrie
2023-02-22 5:17 ` [PATCH v3 2/3] rebase: stop accepting --rebase-merges="" Alex Henrie
2023-02-22 23:56 ` Junio C Hamano
2023-02-23 5:35 ` Alex Henrie
2023-02-22 5:17 ` [PATCH v3 3/3] rebase: add a config option for --rebase-merges Alex Henrie
2023-02-23 0:12 ` Junio C Hamano [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqh6vdb5pm.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=alexhenrie24@gmail.com \
--cc=git@vger.kernel.org \
--cc=newren@gmail.com \
--cc=phillip.wood123@gmail.com \
--cc=tao@klerks.biz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).