git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] completion: Make sed command that generates config-list.h portable.
@ 2025-06-02 18:41 Collin Funk
  2025-06-02 19:05 ` Brad Smith
                   ` (3 more replies)
  0 siblings, 4 replies; 20+ messages in thread
From: Collin Funk @ 2025-06-02 18:41 UTC (permalink / raw)
  To: git; +Cc: jn.avila, Collin Funk, Patrick Steinhardt, Junio C Hamano

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 variable that expands to a newline to do this portably.

This portably issue was introduced in e1b81f54da (completion: take into
account the formatting backticks for options, 2025-03-19)

Signed-off-by: Collin Funk <collin.funk1@gmail.com>
---
 generate-configlist.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/generate-configlist.sh b/generate-configlist.sh
index b06da53c89..48ec8d9812 100755
--- a/generate-configlist.sh
+++ b/generate-configlist.sh
@@ -1,5 +1,8 @@
 #!/bin/sh
 
+nl='
+'
+
 SOURCE_DIR="$1"
 OUTPUT="$2"
 
@@ -19,7 +22,7 @@ EOF
 	s/::$//;
 	s/`//g;
 	s/^.*$/	"&",/;
-	s/,  */",\n	"/g;
+	s/,  */",''"$nl"''	"/g;
 	p;};
 d' \
 	    "$SOURCE_DIR"/Documentation/*config.adoc \
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2025-06-03 23:57 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-02 18:41 [PATCH] completion: Make sed command that generates config-list.h portable Collin Funk
2025-06-02 19:05 ` Brad Smith
2025-06-02 19:05 ` Jean-Noël AVILA
2025-06-02 19:20   ` Collin Funk
2025-06-02 19:26 ` [PATCH v2] " Collin Funk
2025-06-02 19:49   ` Jean-Noël AVILA
2025-06-02 20:08     ` Collin Funk
2025-06-02 21:42       ` Jacob Keller
2025-06-02 22:35         ` Collin Funk
2025-06-03  0:21         ` Junio C Hamano
2025-06-03  0:49           ` [PATCH] CodingGuidelines: document formatting required by generate-configlist.sh Collin Funk
2025-06-03 14:54             ` Junio C Hamano
2025-06-03 18:56               ` Collin Funk
2025-06-03 20:43                 ` Junio C Hamano
2025-06-03 22:49                   ` Collin Funk
2025-06-03 22:45             ` [PATCH v2] CodingGuidelines: document formatting of similar config variables Collin Funk
2025-06-03 23:57               ` Junio C Hamano
2025-06-02 22:31 ` [PATCH v3] completion: make sed command that generates config-list.h portable Collin Funk
2025-06-02 23:05   ` Keller, Jacob E
2025-06-03  0:17     ` Junio C Hamano

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).