From 01d4721565f1562172149ebb91d29d6a7e7f922d Mon Sep 17 00:00:00 2001 From: Stefan Zager Date: Wed, 25 Jul 2012 10:41:54 -0700 Subject: Make 'git submodule update --force' always check out submodules. Currently, it will only do a checkout if the sha1 registered in the containing repository doesn't match the HEAD of the submodule, regardless of whether the submodule is dirty. As discussed on the mailing list, the '--force' flag is a strong indicator that the state of the submodule is suspect, and should be reset to HEAD. Signed-off-by: Stefan Zager Acked-by: Jens Lehmann Signed-off-by: Junio C Hamano --- t/t7406-submodule-update.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 't') diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh index dcb195b4c..8e9c380c4 100755 --- a/t/t7406-submodule-update.sh +++ b/t/t7406-submodule-update.sh @@ -123,6 +123,18 @@ test_expect_success 'submodule update should throw away changes with --force ' ' ) ' +test_expect_success 'submodule update --force forcibly checks out submodules' ' + (cd super && + (cd submodule && + rm -f file + ) && + git submodule update --force submodule && + (cd submodule && + test "$(git status -s file)" = "" + ) + ) +' + test_expect_success 'submodule update --rebase staying on master' ' (cd super/submodule && git checkout master -- cgit v1.2.1