submodule--helper: fix bad config API usage
commitd4a492f4ad0455710a7db8c589f4865810b0d0b7
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Wed, 31 Aug 2022 23:18:15 +0000 (1 01:18 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 2 Sep 2022 16:16:25 +0000 (2 09:16 -0700)
tree21e943eacb38558f68787b000291aacb83254418
parent86e16ed3a9fbf03bc8a5d4030177980193e30f57
submodule--helper: fix bad config API usage

Fix bad config API usage added in a452128a36c (submodule--helper:
introduce add-config subcommand, 2021-08-06). After
git_config_get_string() returns successfully we know the "char **dest"
will be non-NULL.

A coccinelle patch that transforms this turns up a couple of other
such issues, one in fetch-pack.c, and another in upload-pack.c:

@@
identifier F =~ "^(repo|git)_config_get_string(_tmp)?$";
identifier V;
@@
  !F(..., &V)
- && (V)

But let's focus narrowly on submodule--helper for now, we can fix
those some other time.

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