]> git.ipfire.org Git - thirdparty/git.git/commit - builtin/submodule--helper.c
submodule--helper: refactor "errmsg_str" to be a "struct strbuf"
authorGlen Choo <chooglen@google.com>
Wed, 31 Aug 2022 23:17:59 +0000 (01:17 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 2 Sep 2022 16:16:24 +0000 (09:16 -0700)
commit9d02f9499ffe7af9ce7e449e482820d437f84026
tree7f878c854c8a9d8e0a95cfd189ba3cf13db83ef4
parenta253be682f96bcb66ea427b9f7421f16dc063676
submodule--helper: refactor "errmsg_str" to be a "struct strbuf"

Refactor code added in e83e3333b57 (submodule: port submodule
subcommand 'summary' from shell to C, 2020-08-13) so that "errmsg" and
"errmsg_str" are folded into one. The distinction between the empty
string and NULL is something that's tested for by
e.g. "t/t7401-submodule-summary.sh".

This is in preparation for fixing a memory leak the "struct strbuf" in
the pre-image.

Let's also pass a "const char *" to print_submodule_summary(), as it
should not be modifying the "errmsg".

Signed-off-by: Glen Choo <chooglen@google.com>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Reviewed-by: Glen Choo <chooglen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/submodule--helper.c