22 lines
438 B
Bash
Executable File
22 lines
438 B
Bash
Executable File
#!/usr/bin/env zsh
|
|
|
|
emulate -L zsh -o err_return
|
|
|
|
git submodule sync --recursive
|
|
|
|
if [[ "$1" == "--new" ]]; then
|
|
# Only checkout new submodules
|
|
|
|
local toplevel
|
|
toplevel="$(git rev-parse --show-toplevel)"
|
|
cd "$toplevel"
|
|
|
|
grep path .gitmodules \
|
|
| cut -d= -f2 \
|
|
| sed 's/^\s*//' \
|
|
| xargs -I'{}' find '{}' -maxdepth 0 -empty \
|
|
| xargs -L1 git submodule update --init --recursive --
|
|
else
|
|
git submodule update --init --recursive
|
|
fi
|