From: Dato Simó Date: Mon, 23 Sep 2013 21:13:54 +0000 (+0100) Subject: vcsh: strip host part from GIT_REMOTE when inferring VCSH_REPO_NAME X-Git-Url: https://git.madduck.net/code/vcsh.git/commitdiff_plain/b4bee06a2de5d74f9b1de64ffbb464e235a3194a?hp=-c vcsh: strip host part from GIT_REMOTE when inferring VCSH_REPO_NAME `vcsh clone` does: VCSH_REPO_NAME=$(basename "${GIT_REMOTE}" .git) Typically, most remote paths will have a non-empty directory component, so using basename works well in all common cases. However, when doing something like: % vcsh clone example.org:repo.git VCSH_REPO_NAME will be set to "example.org:repo" instead of "repo". This also happens when using url..insteadOf, à-la: % vcsh clone v:repo Stripping everything up to the first colon in the remote URL fixes the issue. N.B.: remote URLs with protocol (e.g. http://, git://, or ssh://) do not exhibit this problem, and are unaffected by this change. Conflicts: vcsh --- b4bee06a2de5d74f9b1de64ffbb464e235a3194a diff --git a/vcsh b/vcsh index 5d502e7..5d5628e 100755 --- a/vcsh +++ b/vcsh @@ -416,7 +416,7 @@ esac if [ "$VCSH_COMMAND" = 'clone' ]; then [ -z "$2" ] && fatal "$VCSH_COMMAND: please specify a remote" 1 GIT_REMOTE="$2" - [ -n "$3" ] && VCSH_REPO_NAME="$3" || VCSH_REPO_NAME=$(basename "$GIT_REMOTE" .git) + [ -n "$3" ] && VCSH_REPO_NAME="$3" || VCSH_REPO_NAME=$(basename "${GIT_REMOTE#*:}" .git) [ -z "$VCSH_REPO_NAME" ] && fatal "$VCSH_COMMAND: could not determine repository name" 1 export VCSH_REPO_NAME export GIT_DIR="$VCSH_REPO_D/$VCSH_REPO_NAME.git"