config/git: fix newline issue in git-get

This commit is contained in:
xeruf 2021-11-07 00:22:45 +01:00
parent 2b44f0eb08
commit 6eb61dc70b
2 changed files with 6 additions and 3 deletions

View File

@ -4,5 +4,5 @@ set -e
remote=$(git-repo "$@") remote=$(git-repo "$@")
echo "Cloning $remote" echo "Cloning $remote"
git clone $remote ${@:4} --recurse-submodules git clone $remote ${@:4} --recurse-submodules
cd "$(expr "$2" || basename ${remote%.git})" cd "$(test -n "$2" && echo "$2" || basename ${remote%.git})"
exec "$SHELL" exec "$SHELL"

View File

@ -1,7 +1,10 @@
#!/bin/sh #!/bin/sh
# Translates different repo notations into ssh # Translate different repo notations into ssh
# Usage:
# git repo <url>
# git repo <host> <repo> [user]
case "$1" in case "$1" in
(http*) echo $1 | sed "s|.*//\([^/]*\)/\(.*\)|git@\1:\2.git|";; (http*) echo "$1" | sed "s|.*//\([^/]*\)/\(.*\)|git@\1:\2.git|" ;;
(git:*) echo "$1" ;; (git:*) echo "$1" ;;
(*) echo "${1:-git.jfischer.org}:${3:-$(git config user.name)}/${2:-$(basename $PWD)}.git" ;; (*) echo "${1:-git.jfischer.org}:${3:-$(git config user.name)}/${2:-$(basename $PWD)}.git" ;;
esac esac