]> git.ipfire.org Git - thirdparty/git.git/blame - t/t5600-clone-fail-cleanup.sh
correct type of EMPTY_TREE_SHA1_BIN
[thirdparty/git.git] / t / t5600-clone-fail-cleanup.sh
CommitLineData
5508a616
CW
1#!/bin/sh
2#
3# Copyright (C) 2006 Carl D. Worth <cworth@cworth.org>
4#
5
3604e7c5 6test_description='test git clone to cleanup after failure
5508a616 7
3604e7c5 8This test covers the fact that if git clone fails, it should remove
5508a616
CW
9the directory it created, to avoid the user having to manually
10remove the directory before attempting a clone again.'
11
12. ./test-lib.sh
13
41ac414e 14test_expect_success \
5508a616 15 'clone of non-existent source should fail' \
3604e7c5 16 'test_must_fail git clone foo bar'
5508a616 17
41ac414e 18test_expect_success \
5508a616 19 'failed clone should not leave a directory' \
41ac414e 20 '! test -d bar'
5508a616
CW
21
22# Need a repo to clone
23test_create_repo foo
24
25# 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)
27
3604e7c5 28# source repository given to git clone should be relative to the
ced78b39 29# current path not to the target dir
41ac414e 30test_expect_success \
ced78b39 31 'clone of non-existent (relative to $PWD) source should fail' \
3604e7c5 32 'test_must_fail git clone ../foo baz'
ced78b39 33
5508a616
CW
34test_expect_success \
35 'clone should work now that source exists' \
3604e7c5 36 'git clone foo bar'
5508a616
CW
37
38test_expect_success \
3dff5379 39 'successful clone must leave the directory' \
5508a616
CW
40 'cd bar'
41
42test_done