Skip to content

Commit

Permalink
Merge branch 'jl/maint-fetch-recursive-fix' into maint
Browse files Browse the repository at this point in the history
* jl/maint-fetch-recursive-fix:
  fetch: Also fetch submodules in subdirectories in on-demand mode
  • Loading branch information
Junio C Hamano committed Aug 1, 2011
2 parents 6124690 + ea2d325 commit 62607e4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions submodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@ void check_for_new_submodule_commits(unsigned char new_sha1[20])
while (parent) {
struct diff_options diff_opts;
diff_setup(&diff_opts);
DIFF_OPT_SET(&diff_opts, RECURSIVE);
diff_opts.output_format |= DIFF_FORMAT_CALLBACK;
diff_opts.format_callback = submodule_collect_changed_cb;
if (diff_setup_done(&diff_opts) < 0)
Expand Down
16 changes: 8 additions & 8 deletions t/t5526-fetch-submodules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ test_expect_success setup '
git init &&
echo subcontent > subfile &&
git add subfile &&
git submodule add "$pwd/deepsubmodule" deepsubmodule &&
git submodule add "$pwd/deepsubmodule" subdir/deepsubmodule &&
git commit -a -m new
) &&
git submodule add "$pwd/submodule" submodule &&
Expand All @@ -58,7 +58,7 @@ test_expect_success setup '
git submodule update --init --recursive
) &&
echo "Fetching submodule submodule" > expect.out &&
echo "Fetching submodule submodule/deepsubmodule" >> expect.out
echo "Fetching submodule submodule/subdir/deepsubmodule" >> expect.out
'

test_expect_success "fetch --recurse-submodules recurses into submodules" '
Expand Down Expand Up @@ -277,12 +277,12 @@ test_expect_success "Recursion picks up all submodules when necessary" '
(
cd submodule &&
(
cd deepsubmodule &&
cd subdir/deepsubmodule &&
git fetch &&
git checkout -q FETCH_HEAD
) &&
head1=$(git rev-parse --short HEAD^) &&
git add deepsubmodule &&
git add subdir/deepsubmodule &&
git commit -m "new deepsubmodule"
head2=$(git rev-parse --short HEAD) &&
echo "From $pwd/submodule" > ../expect.err.sub &&
Expand All @@ -309,12 +309,12 @@ test_expect_success "'--recurse-submodules=on-demand' doesn't recurse when no ne
(
cd submodule &&
(
cd deepsubmodule &&
cd subdir/deepsubmodule &&
git fetch &&
git checkout -q FETCH_HEAD
) &&
head1=$(git rev-parse --short HEAD^) &&
git add deepsubmodule &&
git add subdir/deepsubmodule &&
git commit -m "new deepsubmodule"
head2=$(git rev-parse --short HEAD) &&
echo "From $pwd/submodule" > ../expect.err.sub &&
Expand Down Expand Up @@ -345,13 +345,13 @@ test_expect_success "'--recurse-submodules=on-demand' recurses as deep as necess
git config fetch.recurseSubmodules false &&
(
cd submodule &&
git config -f .gitmodules submodule.deepsubmodule.fetchRecursive false
git config -f .gitmodules submodule.subdir/deepsubmodule.fetchRecursive false
) &&
git fetch --recurse-submodules=on-demand >../actual.out 2>../actual.err &&
git config --unset fetch.recurseSubmodules
(
cd submodule &&
git config --unset -f .gitmodules submodule.deepsubmodule.fetchRecursive
git config --unset -f .gitmodules submodule.subdir/deepsubmodule.fetchRecursive
)
) &&
test_i18ncmp expect.out actual.out &&
Expand Down

0 comments on commit 62607e4

Please sign in to comment.