From: Nicolas Boisselier Date: Tue, 6 Sep 2016 14:09:44 +0000 (+0100) Subject: git.sh X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=7b6cf02be134cc9f22c62f64e26c3a95c13c2253;p=nb.git git.sh --- diff --git a/etc/profile.d/git.sh b/etc/profile.d/git.sh index 6dc9b47c..bfe51395 100644 --- a/etc/profile.d/git.sh +++ b/etc/profile.d/git.sh @@ -77,7 +77,7 @@ git_create() { shell_help "Usage: $FUNCNAME create git project from current dir" "$@" && return 1 declare dir="$(basename $(pwd))" - declare repo="$GIT_REPO" + declare repo=$(echo "$GIT_REPO" | perl -pe 's,^\w+://,,; s,/.*$,,;') [ -n "$1" ] && repo="$1" && shift # @@ -108,9 +108,16 @@ git_create() { } git_clone() { - git clone $GIT_REPO:${1%.git}.git + declare repo=$GIT_REPO + case "$repo" in + *"//"*) ;; + *) repo="$repo:" + esac + + git clone ${repo}${1%.git}.git } git_list() { - ssh $GIT_REPO list | perl -ne '/(\S+).git/ and print "$1\n"' + local repo=$(echo "$GIT_REPO" | perl -pe 's,^\w+://,,; s,/.*$,,;') + ssh $repo list | perl -ne '/(\S+).git/ and print "$1\n"' }