Due to a copy and paste bug only the first level of recursion was seen when doing a "git fetch" on a nested submodule tree. Fix that and extend t5526 to find such breakage in the future. Reported-by: Kevin Ballard <kevin@xxxxxx> Signed-off-by: Jens Lehmann <Jens.Lehmann@xxxxxx> --- submodule.c | 1 - t/t5526-fetch-submodules.sh | 30 +++++++++++++++++++++++++----- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/submodule.c b/submodule.c index 2380638..a62cae5 100644 --- a/submodule.c +++ b/submodule.c @@ -256,7 +256,6 @@ int fetch_populated_submodules(int forced) cp.env = local_repo_env; cp.git_cmd = 1; cp.no_stdin = 1; - cp.out = -1; for_each_string_list_item(name_for_path, &config_name_for_path) { struct strbuf submodule_path = STRBUF_INIT; diff --git a/t/t5526-fetch-submodules.sh b/t/t5526-fetch-submodules.sh index 489ef1a..cabf118 100755 --- a/t/t5526-fetch-submodules.sh +++ b/t/t5526-fetch-submodules.sh @@ -16,29 +16,49 @@ add_upstream_commit() { git add subfile && git commit -m new subfile && head2=$(git rev-parse --short HEAD) && - echo "From $pwd/submodule" > ../expect.err + echo "From $pwd/submodule" > ../expect.err && + echo " $head1..$head2 master -> origin/master" >> ../expect.err + ) + ( + cd deepsubmodule && + head1=$(git rev-parse --short HEAD) && + echo new >> deepsubfile && + test_tick && + git add deepsubfile && + git commit -m new deepsubfile && + head2=$(git rev-parse --short HEAD) && + echo "From $pwd/deepsubmodule" >> ../expect.err && echo " $head1..$head2 master -> origin/master" >> ../expect.err ) } test_expect_success setup ' + mkdir deepsubmodule && + ( + cd deepsubmodule && + git init && + echo deepsubcontent > deepsubfile && + git add deepsubfile && + git commit -m new deepsubfile + ) && mkdir submodule && ( cd submodule && git init && echo subcontent > subfile && git add subfile && - git commit -m new subfile + git submodule add "$pwd/deepsubmodule" deepsubmodule && + git commit -a -m new ) && git submodule add "$pwd/submodule" submodule && git commit -am initial && git clone . downstream && ( cd downstream && - git submodule init && - git submodule update + git submodule update --init --recursive ) && - echo "Fetching submodule submodule" > expect.out + echo "Fetching submodule submodule" > expect.out && + echo "Fetching submodule deepsubmodule" >> expect.out ' test_expect_success "fetch recurses into submodules" ' -- 1.7.3.rc2.234.g00c0 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html