Skip to content

Commit 58f4203

Browse files
stefanbellergitster
authored andcommitted
builtin/fetch.c: respect 'submodule.recurse' option
Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 4e53d6a commit 58f4203

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

builtin/fetch.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,13 @@ static int git_fetch_config(const char *k, const char *v, void *cb)
7373
fetch_prune_config = git_config_bool(k, v);
7474
return 0;
7575
}
76+
77+
if (!strcmp(k, "submodule.recurse")) {
78+
int r = git_config_bool(k, v) ?
79+
RECURSE_SUBMODULES_ON : RECURSE_SUBMODULES_OFF;
80+
recurse_submodules = r;
81+
}
82+
7683
return git_default_config(k, v, cb);
7784
}
7885

t/t5526-fetch-submodules.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,16 @@ test_expect_success "fetch --recurse-submodules recurses into submodules" '
7171
test_i18ncmp expect.err actual.err
7272
'
7373

74+
test_expect_success "submodule.recurse option triggers recursive fetch" '
75+
add_upstream_commit &&
76+
(
77+
cd downstream &&
78+
git -c submodule.recurse fetch >../actual.out 2>../actual.err
79+
) &&
80+
test_must_be_empty actual.out &&
81+
test_i18ncmp expect.err actual.err
82+
'
83+
7484
test_expect_success "fetch --recurse-submodules -j2 has the same output behaviour" '
7585
add_upstream_commit &&
7686
(

0 commit comments

Comments
 (0)