hooks: set up sparse checkout after cloning the vcsh repository
[config/vcsh.git] / .config / vcsh / hooks-available / submodule-update.sh
1 #!/bin/sh
2
3 set -e
4
5 GIT_VERSION_MAJOR=$(git --version | sed -n 's/.* \([0-9]\{1,\}\)\..*/\1/p' )
6 GIT_VERSION_MINOR=$(git --version | sed -n 's/.* \([0-9]\{1,\}\)\.\([0-9]\{1,\}\).*/\2/p' )
7
8 if [ "$GIT_VERSION_MAJOR" -lt 2 ] || [ "$GIT_VERSION_MINOR" -lt 20 ];
9 then
10   echo "Git >= 2.20 is required for submodules to work properly with vcsh" 1>&2
11   exit 1
12 fi
13
14 git submodule sync --recursive
15 git submodule update --init --recursive