]> git.ipfire.org Git - thirdparty/git.git/commitdiff
generate-cmdlist.sh: replace for loop by printf's auto-repeat feature
authorJohannes Sixt <j6t@kdbg.org>
Fri, 5 Nov 2021 14:08:04 +0000 (15:08 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 5 Nov 2021 19:01:13 +0000 (12:01 -0700)
This is just a small code reduction. There is a small probability that
the new code breaks when the category list is empty. But that would be
noticed during the compile step.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
generate-cmdlist.sh

index e517c33710a84980194bb45ce083eb321b091a7b..a1ab2b1f07728d0cdd3f442cd9b3e23bf6280c3c 100755 (executable)
@@ -67,10 +67,7 @@ print_command_list () {
        while read cmd rest
        do
                printf "        { \"$cmd\", $(get_synopsis $cmd), 0"
-               for cat in $(echo "$rest" | get_category_line)
-               do
-                       printf " | CAT_$cat"
-               done
+               printf " | CAT_%s" $(echo "$rest" | get_category_line)
                echo " },"
        done
        echo "};"