bin/git-fork: https compatibility
This commit is contained in:
parent
af2699a66e
commit
e888d12fb9
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash -e
|
#!/bin/bash -ex
|
||||||
# Clones a fork and sets a corresponding upstream
|
# Clones a fork and sets a corresponding upstream
|
||||||
# ARGS
|
# ARGS
|
||||||
# - repo name (omit if setting upstream in existing repo)
|
# - repo name (omit if setting upstream in existing repo)
|
||||||
|
@ -14,8 +14,12 @@ then repo="$(basename "$PWD")"
|
||||||
git remote remove upstream 2>/dev/null || true
|
git remote remove upstream 2>/dev/null || true
|
||||||
else test $# -eq 0 && echo "Usage: $0 <repo (omit if in repo)> <upstream owner> [own user] [host]" && exit 2
|
else test $# -eq 0 && echo "Usage: $0 <repo (omit if in repo)> <upstream owner> [own user] [host]" && exit 2
|
||||||
repo="$1" && shift
|
repo="$1" && shift
|
||||||
if test "$#" -eq 0
|
if test $# -eq 0
|
||||||
then git-get "$repo"
|
then
|
||||||
|
git-get "$repo"
|
||||||
|
cd "$(basename "$repo")"
|
||||||
|
git-fork "$repo"
|
||||||
|
exit $?
|
||||||
else
|
else
|
||||||
test -d "$d1" && cd "$d1/0-forks"
|
test -d "$d1" && cd "$d1/0-forks"
|
||||||
if ! git-get "${3:-github.com}" "$repo" "${2:-$(git config --get user.name)}" "${@:4}"
|
if ! git-get "${3:-github.com}" "$repo" "${2:-$(git config --get user.name)}" "${@:4}"
|
||||||
|
@ -26,6 +30,8 @@ else test $# -eq 0 && echo "Usage: $0 <repo (omit if in repo)> <upstream owner>
|
||||||
cd "$(basename "$(expr "$4" \| "$repo")")"
|
cd "$(basename "$(expr "$4" \| "$repo")")"
|
||||||
fi
|
fi
|
||||||
user="${1:-$repo}"
|
user="${1:-$repo}"
|
||||||
git-upstream "$user"
|
case "$user" in
|
||||||
#git remote add upstream "$(git-repo "${3:-github.com}" "$repo" "$user")"
|
(http*) git remote add upstream "$user";;
|
||||||
|
(*) git-upstream "$user";;
|
||||||
|
esac
|
||||||
exec $SHELL
|
exec $SHELL
|
||||||
|
|
Loading…
Reference in New Issue