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

Re: [PATCH] merge-ort: accept rename settings given without a value

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 1, 2026, 00:52 UTC
Message-ID
<xmqqjymx2x0c.fsf@gitster.g>
In-Reply-To
<pull.2284.git.1793441202854.gitgitgadget@gmail.com>
"Thomas Bachem via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 8 quoted lines
> From: Thomas Bachem <mail@thomasbachem.com>
>
> "git -c merge.renames merge" fails with "missing value for
> 'merge.renames'", although git(1) says that "git -c foo.bar" sets
> foo.bar to true. The same happens with diff.renames and
> merge.directoryRenames, and with a setting written without
> "= <value>" in a config file, which git-config(1) also documents as
> true. Every command that merges through merge-ort fails this way.

Searching the list archive for "valueless true" tells us that we had corrected a handful of instances of config_get_string() with a call to config_get_value() in the past half year.

And this patch seems to be in line with the other efforts to fix the same misuse.

Show 17 quoted lines
> +	if (!repo_config_get_value(opt->repo, "diff.renames", &v))
> +		opt->detect_renames = git_config_rename("diff.renames", v);
> +	if (!repo_config_get_value(opt->repo, "merge.renames", &v))
> +		opt->detect_renames = git_config_rename("merge.renames", v);
> +	if (!repo_config_get_value(opt->repo, "merge.directoryrenames", &v)) {
> +		int boolval = git_parse_maybe_bool(v);
>  		if (0 <= boolval) {
>  			opt->detect_directory_renames = boolval ?
>  				MERGE_DIRECTORY_RENAMES_TRUE :
>  				MERGE_DIRECTORY_RENAMES_NONE;
> -		} else if (!strcasecmp(value, "conflict")) {
> +		} else if (!strcasecmp(v, "conflict")) {
>  			opt->detect_directory_renames =
>  				MERGE_DIRECTORY_RENAMES_CONFLICT;
>  		} /* avoid erroring on values from future versions of git */
> -		free(value);
>  	}

OK. Since get_value(), unlike get_string(), lets us borrow the value as "const char *", once we used to drive git_config_rename() or compared with fixed string to turn it into an enum value, we can simply forget without calling free(), which is simpler.

Nicely done.
Previous: Thomas Bachem via GitGitGadget
Message 2 of 2 in “merge-ort: accept rename settings given without a value”
  1. merge-ort: accept rename settings given without a valueThomas Bachem via GitGitGadget, Oct 31, 2026
  2. Junio C HamanoNov 1, 2026

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.