t5603-clone-dirname.sh [plain text]
#!/bin/sh
test_description='check output directory names used by git-clone'
. ./test-lib.sh
test_expect_success 'setup ssh wrapper' '
write_script "$TRASH_DIRECTORY/ssh-wrapper" <<-\EOF &&
git upload-pack "$TRASH_DIRECTORY"
EOF
GIT_SSH="$TRASH_DIRECTORY/ssh-wrapper" &&
GIT_SSH_VARIANT=ssh &&
export GIT_SSH &&
export GIT_SSH_VARIANT &&
export TRASH_DIRECTORY
'
test_clone_dir () {
url=$1; shift
dir=$1; shift
expect=success
bare=non-bare
clone_opts=
for i in "$@"
do
case "$i" in
fail)
expect=failure
;;
bare)
bare=bare
clone_opts=--bare
;;
esac
done
test_expect_$expect "clone of $url goes to $dir ($bare)" "
rm -rf $dir &&
git clone $clone_opts $url &&
test_path_is_dir $dir
"
}
test_clone_dir host:foo foo
test_clone_dir host:foo foo.git bare
test_clone_dir host:foo.git foo
test_clone_dir host:foo.git foo.git bare
test_clone_dir host:foo/.git foo
test_clone_dir host:foo/.git foo.git bare
test_clone_dir ssh://host/foo foo
test_clone_dir ssh://host/foo foo.git bare
test_clone_dir ssh://host/foo.git foo
test_clone_dir ssh://host/foo.git foo.git bare
test_clone_dir ssh://host/foo/.git foo
test_clone_dir ssh://host/foo/.git foo.git bare
test_clone_dir ssh://host/foo/ foo
test_clone_dir ssh://host/foo/// foo
test_clone_dir ssh://host/foo/.git/ foo
test_clone_dir ssh://host/foo.git/ foo
test_clone_dir ssh://host/foo.git/// foo
test_clone_dir ssh://host/foo///.git/ foo
test_clone_dir ssh://host/foo/.git/// foo
test_clone_dir host:foo/ foo
test_clone_dir host:foo/// foo
test_clone_dir host:foo.git/ foo
test_clone_dir host:foo/.git/ foo
test_clone_dir host:foo.git/// foo
test_clone_dir host:foo///.git/ foo
test_clone_dir host:foo/.git/// foo
test_clone_dir ssh://host/ host
test_clone_dir ssh://host:1234/ host
test_clone_dir ssh://user@host/ host
test_clone_dir host:/ host
test_clone_dir ssh://user:password@host/ host
test_clone_dir ssh://user:password@host:1234/ host
test_clone_dir ssh://user:passw@rd@host:1234/ host
test_clone_dir user@host:/ host
test_clone_dir user:password@host:/ host
test_clone_dir user:passw@rd@host:/ host
test_clone_dir ssh://host/foo@bar foo@bar
test_clone_dir ssh://host/foo@bar.git foo@bar
test_clone_dir ssh://user:password@host/foo@bar foo@bar
test_clone_dir ssh://user:passw@rd@host/foo@bar.git foo@bar
test_clone_dir host:/foo@bar foo@bar
test_clone_dir host:/foo@bar.git foo@bar
test_clone_dir user:password@host:/foo@bar foo@bar
test_clone_dir user:passw@rd@host:/foo@bar.git foo@bar
test_clone_dir ssh://user:password@host/test:1234 1234
test_clone_dir ssh://user:password@host/test:1234.git 1234
test_done