On Mon, May 08, 2023 at 03:51:52PM -0700, Glen Choo wrote: > Patrick Steinhardt writes: [snip] > > +test_expect_success "fetch --all with --no-recurse-submodules only fetches superproject" ' > > + test_when_finished "git -C downstream remote remove second" && > > + > > + # We need to add a second remote, otherwise --all falls back to the > > + # normal fetch-one case. > > + git -C downstream remote add second .. && > > + git -C downstream fetch --all && > > + > > + add_submodule_commits && > > + add_superproject_commits && > > + old_commit=$(git rev-parse --short HEAD~) && > > + new_commit=$(git rev-parse --short HEAD) && > > + > > + git -C downstream fetch --all --no-recurse-submodules >actual.out 2>actual.err && > > + > > + cat >expect.out <<-EOF && > > + Fetching origin > > + Fetching second > > + EOF > > + > > + cat >expect.err <<-EOF && > > + From $(test-tool path-utils real_path .)/. > > + $old_commit..$new_commit super -> origin/super > > + From .. > > + $old_commit..$new_commit super -> second/super > > + EOF > > + > > + test_cmp expect.out actual.out && > > + test_cmp expect.err actual.err > > +' > > The test looks okay, though is there a reason you didn't copy the style > of the previous test? It is nearly exactly what you want, I think, like > (untested) > > test_expect_success "fetch --all with --no-recurse-submodules only fetches superproject" ' > test_when_finished "rm -fr src_clone" && > git clone --recurse-submodules src src_clone && > ( > cd src_clone && > git remote add secondary ../src && > git config submodule.recurse true && > git config fetch.parallel 0 && > git fetch --all 2>../fetch-log > ) && > grep "Fetching submodule" fetch-log >fetch-subs && > test_must_be_empty fetch-subs > ' > > which has the handy benefit of not needing the test-tools invocation. That is indeed much simpler, thanks. Patrick