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

Re: [PATCH v3 3/3] rebase: add a config option for --rebase-merges

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 23, 2023, 00:12 UTC
Message-ID
<xmqqh6vdb5pm.fsf@gitster.g>
In-Reply-To
<20230222051709.464275-3-alexhenrie24@gmail.com>
Alex Henrie <alexhenrie24@gmail.com> writes:
Show 9 quoted lines
> +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 ...
Show 13 quoted lines
> +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 ...

Show 10 quoted lines
> @@ -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.

Previous: Alex Henrie
Message 6 of 6 in “rebase: add documentation and tests for --no-rebase-merges”
  1. 1/3 rebase: add documentation and tests for --no-rebase-mergesAlex Henrie, Feb 22, 2023
  2. 2/3 rebase: stop accepting --rebase-merges=""Alex Henrie, Feb 22, 2023
  3. Junio C HamanoFeb 22, 2023
  4. Alex HenrieFeb 23, 2023
  5. 3/3 rebase: add a config option for --rebase-mergesAlex Henrie, Feb 22, 2023
  6. Junio C HamanoFeb 23, 2023

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.