2021-06-18 17:51:57 +02:00
|
|
|
#!/bin/sh
|
2021-11-07 00:22:45 +01:00
|
|
|
# Translate different repo notations into ssh
|
|
|
|
# Usage:
|
|
|
|
# git repo <url>
|
|
|
|
# git repo <host> <repo> [user]
|
2021-06-18 17:51:57 +02:00
|
|
|
case "$1" in
|
2021-11-07 00:22:45 +01:00
|
|
|
(http*) echo "$1" | sed "s|.*//\([^/]*\)/\(.*\)|git@\1:\2.git|" ;;
|
2021-10-31 20:21:35 +01:00
|
|
|
(git:*) echo "$1" ;;
|
2021-11-17 15:55:46 +01:00
|
|
|
(*) host=$1
|
|
|
|
case $1 in
|
|
|
|
(hub) host=git@github.com;;
|
|
|
|
(lab) host=git@gitlab.com;;
|
|
|
|
(*) host=$1;;
|
|
|
|
esac
|
|
|
|
echo "${host:-git.jfischer.org}:${3:-$(git config user.name)}/${2:-$(basename $PWD)}.git" ;;
|
2021-06-18 17:51:57 +02:00
|
|
|
esac
|