aboutsummaryrefslogtreecommitdiffstats
path: root/builtin/submodule--helper.c
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2022-09-01 01:18:15 +0200
committerJunio C Hamano <gitster@pobox.com>2022-09-02 09:16:25 -0700
commitd4a492f4ad0455710a7db8c589f4865810b0d0b7 (patch)
tree21e943eacb38558f68787b000291aacb83254418 /builtin/submodule--helper.c
parent86e16ed3a9fbf03bc8a5d4030177980193e30f57 (diff)
downloadgit-d4a492f4ad0455710a7db8c589f4865810b0d0b7.tar.gz
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>
Diffstat (limited to 'builtin/submodule--helper.c')
-rw-r--r--builtin/submodule--helper.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 3afaddb9a5..3a2a92da51 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -3107,7 +3107,7 @@ static void configure_added_submodule(struct add_data *add_data)
* is_submodule_active(), since that function needs to find
* out the value of "submodule.active" again anyway.
*/
- if (!git_config_get_string("submodule.active", &val) && val) {
+ if (!git_config_get_string("submodule.active", &val)) {
/*
* If the submodule being added isn't already covered by the
* current configured pathspec, set the submodule's active flag