fetch: return when parsing submodule.recurse
PATCH 1/1 fetch: return when parsing submodule.recurse
From: Derrick Stolee <[email protected]>
When parsing config keys, the normal pattern is to return 0 after completing the logic for a specific config key, since no other key will match. One instance, for "submodule.recurse", was missing this case in builtin/fetch.c.
This is a very minor change, and will have minimal impact to performance. This particular block was edited recently in 56e8bb4fb4 (fetch: use fetch_config to store "fetch.recurseSubmodules" value, 2023-05-17), which led to some hesitation that perhaps this omission was on purpose.
However, no later cases within git_fetch_config() will match the key if equal to "submodule.recurse" and neither will any key matches within the catch-all git_default_config().
---
fetch: return when parsing submodule.recurse
This is a super-nit that I noticed when looking into this config setting and couldn't help but try to fix.
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1709%2Fderrickstolee%2Ffetch-config-parse-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1709/derrickstolee/fetch-config-parse-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1709
builtin/fetch.c | 1 + 1 file changed, 1 insertion(+)
builtin/fetch.c +1 -0
@@ -138,6 +138,7 @@ static int git_fetch_config(const char *k, const char *v,int r =git_config_bool (k, v) ?RECURSE_SUBMODULES_ON :RECURSE_SUBMODULES_OFF ; fetch_config->recurse_submodules = r; +return 0 ; }if (!strcmp (k,"submodule.fetchjobs" )) {
base-commit: 7774cfed6261ce2900c84e55906da708c711d601
Signature · 1 line
gitgitgadget
Quoted 9 lines · Derrick Stolee via GitGitGadget
From: Derrick Stolee <[email protected]>
When parsing config keys, the normal pattern is to return 0 after completing the logic for a specific config key, since no other key will match. One instance, for "submodule.recurse", was missing this case in
builtin/fetch.c.This is a very minor change, and will have minimal impact to performance.
True, and the performance impact should be positive, if it is observable.
Well spotted. Thanks.
Quoted 37 lines
This particular block was edited recently in
56e8bb4fb4(fetch: usefetch_configto store "fetch.recurseSubmodules" value, 2023-05-17), which led to some hesitation that perhaps this omission was on purpose.However, no later cases within
git_fetch_config()will match the key if equal to "submodule.recurse" and neither will any key matches within the catch-allgit_default_config().Signed-off-by Derrick Stolee <[email protected]>---
fetch: return when parsing submodule.recurseThis is a super-nit that I noticed when looking into this config setting and couldn't help but try to fix.
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1709%2Fderrickstolee%2Ffetch-config-parse-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1709/derrickstolee/fetch-config-parse-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1709builtin/fetch.c | 1 + 1 file changed, 1 insertion(+)builtin/fetch.c +1
-0@@ -138,6 +138,7 @@ static int git_fetch_config(const char *k, const char *v,int r =git_config_bool (k, v) ?RECURSE_SUBMODULES_ON :RECURSE_SUBMODULES_OFF ; fetch_config->recurse_submodules = r; +return 0 ; }if (!strcmp (k,"submodule.fetchjobs" )) {base-commit:
7774cfed6261ce2900c84e55906da708c711d601