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