git-apply: apply submodule changes

Apply "Subproject commit HEX" changes produced by git-diff.
As usual in the current git, only the superproject itself is actually
modified (possibly creating empty directories for new submodules).
Any checked-out submodule is left untouched and is not required to
be up-to-date.

With clean-ups from Junio C Hamano.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Sven Verdoolaege
2007-08-15 19:22:09 +02:00
committed by Junio C Hamano
parent da899deb24
commit e06c5a6c7b
3 changed files with 117 additions and 25 deletions

View File

@ -175,4 +175,21 @@ test_expect_success 'checkout superproject with subproject already present' '
git-checkout master
'
test_expect_success 'apply submodule diff' '
git branch second &&
(
cd lib &&
echo s >s &&
git add s &&
git commit -m "change subproject"
) &&
git update-index --add lib &&
git-commit -m "change lib" &&
git-format-patch -1 --stdout >P.diff &&
git checkout second &&
git apply --index P.diff &&
D=$(git diff --cached master) &&
test -z "$D"
'
test_done