summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
69069d2)
Git submodules in vcsh can only be supported reliably with git >= 2.20.0
which supports reading the .gitmodules file even when it is not checked
out in the working tree.
To recap, the need for git >= 2.20 is imposed by the following facts:
- vcsh repositories share their working trees in $HOME;
- if files with the same name (e.g. README, LICENSE) are present in
different repositories they would conflict when checked out in
$HOME;
- sparse-checkout can solve the issue by preventing colliding files
between repositories from being checked out, this includes the
.gitmodules file;
- submodules command require the .gitmodules file;
- from git 2.20 the .gitmodules file can be accessed from the
repository object store when the file is not in the working tree,
this enables submodules usage with "vcsh run".
Now that the version check is in place, re-enable the post-clone hook to
update submodules automatically after cloning a repository.
+set -e
+
+GIT_VERSION_MAJOR=$(git --version | sed -n 's/.* \([0-9]\{1,\}\)\..*/\1/p' )
+GIT_VERSION_MINOR=$(git --version | sed -n 's/.* \([0-9]\{1,\}\)\.\([0-9]\{1,\}\).*/\2/p' )
+
+if [ "$GIT_VERSION_MAJOR" -lt 2 ] || [ "$GIT_VERSION_MINOR" -lt 20 ];
+then
+ echo "Git >= 2.20 is required for submodules to work properly with vcsh" 1>&2
+ exit 1
+fi
+
git submodule sync --recursive
git submodule update --init --recursive
git submodule sync --recursive
git submodule update --init --recursive
--- /dev/null
+../hooks-available/submodule-update.sh
\ No newline at end of file