Files
git/generate-configlist.sh
Collin Funk db170e1826 completion: make sed command that generates config-list.h portable.
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 fix this by documenting related configuration variables
one-per-line instead of listing them separated by commas. This allows us
to remove the unportable part of the sed expression in
generate-configlist.sh.

Signed-off-by: Collin Funk <collin.funk1@gmail.com>
Reviewed-by: Jacob Keller <jacob.keller@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-02 17:21:49 -07:00

39 lines
593 B
Bash
Executable File

#!/bin/sh
SOURCE_DIR="$1"
OUTPUT="$2"
if test -z "$SOURCE_DIR" || ! test -d "$SOURCE_DIR" || test -z "$OUTPUT"
then
echo >&2 "USAGE: $0 <SOURCE_DIR> <OUTPUT>"
exit 1
fi
print_config_list () {
cat <<EOF
static const char *config_name_list[] = {
EOF
sed -E '
/^`?[a-zA-Z].*\..*`?::$/ {
/deprecated/d;
s/::$//;
s/`//g;
s/^.*$/ "&",/;
p;};
d' \
"$SOURCE_DIR"/Documentation/*config.adoc \
"$SOURCE_DIR"/Documentation/config/*.adoc|
sort
cat <<EOF
NULL,
};
EOF
}
{
echo "/* Automatically generated by generate-configlist.sh */"
echo
echo
print_config_list
} >"$OUTPUT"