From c7b02f5a7347ea8688c5214f85bb9f612925a586 Mon Sep 17 00:00:00 2001 From: Loic Dachary Date: Thu, 19 Mar 2015 00:32:39 +0100 Subject: [PATCH] doc,tests: force checkout of submodules When updating submodules, always checkout even if the HEAD is the desired commit hash (update --force) to avoid the following: * a directory gmock exists in hammer * a submodule gmock replaces the directory gmock in master * checkout master + submodule update : gmock/.git is created * checkout hammer : the gmock directory still contains the .git from master because it did not exist at the time and checkout won't remove untracked directories * checkout master + submodule update : git rev-parse HEAD is at the desired commit although the content of the gmock directory is from hammer http://tracker.ceph.com/issues/11157 Fixes: #11157 Signed-off-by: Loic Dachary --- autogen.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/autogen.sh b/autogen.sh index 7b7a7d140826e..71d8d8450ce72 100755 --- a/autogen.sh +++ b/autogen.sh @@ -29,7 +29,8 @@ else fi if test -d ".git" ; then - if ! git submodule update --init; then + force=$(if git submodule usage 2>&1 | grep --quiet 'update.*--force'; then echo --force ; fi) + if ! git submodule sync || ! git submodule update $force --init --recursive; then echo "Error: could not initialize submodule projects" echo " Network connectivity might be required." exit 1