Subject: Re: [PATCH v2] completion: Make sed command that generates config-list.h portable.

From: Jean-Noël AVILA <[email-masked]>
Date: Mon, 02 Jun 2025 21:49:28 +0200

On Monday, 2 June 2025 21:26:47 CEST Collin Funk wrote:
> The OpenBSD 'sed' command does not support '\n' to represent newlines in
> sed expressions. This leads to the follow compiler error:
> 
>     In file included from builtin/help.c:15:
>     ./config-list.h:282:18: error: use of undeclared identifier 'n'
>             "gitcvs.dbUser",n       "gitcvs.dbPass",
>                             ^
>     1 error generated.
>     gmake: *** [Makefile:2821: builtin/help.o] Error 1
> 
> We can use a backslash followed by a newline to fix this.
> 
> This portably issue was introduced in e1b81f54da (completion: take into
> account the formatting backticks for options, 2025-03-19)
> 
> Signed-off-by: Collin Funk <[email-masked]>
> ---
>  generate-configlist.sh | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/generate-configlist.sh b/generate-configlist.sh
> index b06da53c89..e1f9e99488 100755
> --- a/generate-configlist.sh
> +++ b/generate-configlist.sh
> @@ -19,7 +19,8 @@ EOF
>  	s/::$//;
>  	s/`//g;
>  	s/^.*$/	"&",/;
> -	s/,  */",\n	"/g;
> +	s/,  */",\
> +	"/g;
>  	p;};
>  d' \
>  	    "$SOURCE_DIR"/Documentation/*config.adoc \

FYI I pushed your patch to 
https://github.com/gitgitgadget/git/pull/1930/

It seems to be passing, although it's not very readable.

Your commit message has some issues:

 * upper case in "Make": prefixed commits message must be lower case
 * to be correct, the bug was already there at the first introduction of the 
generate-configlist.sh script (3ac68a9). The '\n' was there, and the generated 
.h file had two wrong strings such as
"gitcvs.dbUserngitcvs.dbPass" . My patch only put it in light by breaking the 
build.

Maybe an alternative way of fixing the issue is to just rework the 
documentation on the two spots where a comma is used and put each config 
variable on its own line.

What do you think?

JN