1#!/bin/sh2#3# Copyright (C) 2006 Carl D. Worth <cworth@cworth.org>4#56test_description='test git clone to cleanup after failure78This test covers the fact that if git clone fails, it should remove9the directory it created, to avoid the user having to manually10remove the directory before attempting a clone again.'1112. ./test-lib.sh1314test_expect_success \15'clone of non-existent source should fail' \16'test_must_fail git clone foo bar'1718test_expect_success \19'failed clone should not leave a directory' \20'! test -d bar'2122# Need a repo to clone23test_create_repo foo2425# clone doesn't like it if there is no HEAD. Is that a bug?26(cd foo && touch file && git add file && git commit -m 'add file' >/dev/null 2>&1)2728# source repository given to git clone should be relative to the29# current path not to the target dir30test_expect_success \31'clone of non-existent (relative to $PWD) source should fail' \32'test_must_fail git clone ../foo baz'3334test_expect_success \35'clone should work now that source exists' \36'git clone foo bar'3738test_expect_success \39'successful clone must leave the directory' \40'cd bar'4142test_done