diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-03-04 15:02:26 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-03-04 15:02:26 -0800 |
commit | 51aca1665b9fa8214927780fbccd1915649b3c44 (patch) | |
tree | 55489abb9e7ec87845a963eaf7e11e6eaac34edf | |
parent | 63bf941e5a43c343265e836cab2ff2344937e1f6 (diff) | |
parent | a9026187923643235d4f9b876ff5f4c0ebe5c9ae (diff) | |
download | git-51aca1665b9fa8214927780fbccd1915649b3c44.tar.gz git-51aca1665b9fa8214927780fbccd1915649b3c44.tar.xz |
Merge branch 'jk/fail-null-clone'
* jk/fail-null-clone:
clone: die when trying to clone missing local path
-rw-r--r-- | builtin/clone.c | 2 | ||||
-rwxr-xr-x | t/t5701-clone-local.sh | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/builtin/clone.c b/builtin/clone.c index 60d9a6428..2ee1fa984 100644 --- a/builtin/clone.c +++ b/builtin/clone.c @@ -413,7 +413,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix) if (path) repo = xstrdup(make_nonrelative_path(repo_name)); else if (!strchr(repo_name, ':')) - repo = xstrdup(make_absolute_path(repo_name)); + die("repository '%s' does not exist", repo_name); else repo = repo_name; is_local = path && !is_bundle; diff --git a/t/t5701-clone-local.sh b/t/t5701-clone-local.sh index 0f4d487be..6972258b2 100755 --- a/t/t5701-clone-local.sh +++ b/t/t5701-clone-local.sh @@ -144,4 +144,17 @@ test_expect_success 'clone empty repository, and then push should not segfault.' test_must_fail git push) ' +test_expect_success 'cloning non-existent directory fails' ' + cd "$D" && + rm -rf does-not-exist && + test_must_fail git clone does-not-exist +' + +test_expect_success 'cloning non-git directory fails' ' + cd "$D" && + rm -rf not-a-git-repo not-a-git-repo-clone && + mkdir not-a-git-repo && + test_must_fail git clone not-a-git-repo not-a-git-repo-clone +' + test_done |