]> git.madduck.net Git - code/vcsh.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

vcsh: strip host part from GIT_REMOTE when inferring VCSH_REPO_NAME
authorDato Simó <dato@net.com.org.es>
Mon, 23 Sep 2013 21:13:54 +0000 (22:13 +0100)
committerRichard Hartmann <richih@debian.org>
Tue, 4 Feb 2014 22:03:01 +0000 (23:03 +0100)
`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.<x>.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

vcsh

diff --git a/vcsh b/vcsh
index 5d502e7c68f372a427f0ad68e62bc8938899cead..5d5628e236368e7d11addeedc57c60c8f87fa8a6 100755 (executable)
--- 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"
 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"
        [ -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"