2022-06-27 19:50:29 +00:00
|
|
|
#!/bin/sh -ex
|
2021-06-18 15:51:57 +00:00
|
|
|
# Clones from resolving the arguments and switches into the new directory
|
2022-06-27 19:50:29 +00:00
|
|
|
# ARGS see git-repo, all arguments beyond the first three are forwarded to git-clone
|
2021-06-19 19:24:14 +00:00
|
|
|
remote=$(git-repo "$@")
|
|
|
|
echo "Cloning $remote"
|
2022-06-27 19:50:29 +00:00
|
|
|
case $# in
|
|
|
|
(1) dir=$(basename ${remote%.git});;
|
|
|
|
(3) prefix=$(echo "$3" | sed "s|\(.\)\b.*$|\1|")
|
|
|
|
case "$2" in
|
|
|
|
("$prefix"*) ;;
|
|
|
|
(*) dir="${prefix}_$2";;
|
|
|
|
esac;;
|
|
|
|
esac
|
|
|
|
shift 3
|
|
|
|
git clone $remote "$@" $dir --recurse-submodules
|
|
|
|
cd "${dir:-${4:-$2}}"
|