2021-10-31 19:21:35 +00:00
|
|
|
#!/bin/sh -e
|
2021-06-19 19:24:14 +00:00
|
|
|
# Clones a fork and sets a corresponding upstream
|
2021-10-11 08:02:14 +00:00
|
|
|
# ARGS
|
2021-06-19 19:24:14 +00:00
|
|
|
# - repo name
|
|
|
|
# - upstream user
|
|
|
|
# - local user
|
2021-10-11 08:02:14 +00:00
|
|
|
# - url
|
2021-10-08 10:31:00 +00:00
|
|
|
# - target directory name (and further arguments to clone)
|
2021-10-31 19:21:35 +00:00
|
|
|
if test -d ".git"
|
|
|
|
then git remote set-url origin "$(git-repo "${4:-github.com}" "$1" "$3" "${@:5}")"
|
|
|
|
else git-get "${4:-github.com}" "$1" "$3" "${@:5}"
|
|
|
|
cd $(expr "$5" \| "$1")
|
|
|
|
fi
|
2021-10-11 08:02:14 +00:00
|
|
|
test "$2" && git remote add upstream "$(git-repo "${4:-github.com}" "$1" "$2")"
|
2021-06-19 19:24:14 +00:00
|
|
|
git remote -v
|