fix: split submodule init and checkout steps

Git does not initialize submodules during `git checkout`, even when
`--recurse-submodules` is used. This causes issues when switching to a
commit that introduces a new submodule, as Git tries to update the
uninitialised submodule [1]. Split the steps to explicitly initialize
submodules after checkout to ensure all nested repositories are properly
loaded.

[1] https://stackoverflow.com/a/72275916

Change-Id: I20a9cf43affd45c0a67ab1ae9a4db0e6f75973a7
Signed-off-by: Harrison Mutai <harrison.mutai@arm.com>
diff --git a/scripts/clone.sh b/scripts/clone.sh
index 1d904ec..e28c331 100755
--- a/scripts/clone.sh
+++ b/scripts/clone.sh
@@ -191,7 +191,8 @@
             git fetch ${REPO_URL} ${REPO_REFSPEC}
         fi
 
-        git checkout --recurse-submodules FETCH_HEAD
+        git checkout FETCH_HEAD
+        git submodule update --init --recursive
         echo "Freshly cloned ${REPO_URL} (refspec ${REPO_REFSPEC}):"
         git log -1
         cd $OLDPWD