clone: add flag not to link

This commit is contained in:
Carlos Martín Nieto 2014-05-28 10:07:23 +02:00
parent 121b26738e
commit c1dbfcbb4a
3 changed files with 4 additions and 1 deletions

View File

@ -27,6 +27,7 @@ typedef enum {
GIT_CLONE_LOCAL_AUTO,
GIT_CLONE_LOCAL,
GIT_CLONE_NO_LOCAL,
GIT_CLONE_LOCAL_NO_LINKS,
} git_clone_local_t;
/**

View File

@ -357,7 +357,7 @@ int git_clone__should_clone_local(const char *url, git_clone_local_t local)
is_url = !git__prefixcmp(url, "file://");
if (is_url && local != GIT_CLONE_LOCAL)
if (is_url && local != GIT_CLONE_LOCAL && local != GIT_CLONE_LOCAL_NO_LINKS )
return false;
path = url;

View File

@ -19,11 +19,13 @@ void test_clone_local__should_clone_local(void)
cl_git_pass(git_buf_printf(&buf, "file://%s", cl_fixture("testrepo.git")));
cl_assert_equal_i(false, git_clone__should_clone_local(buf.ptr, GIT_CLONE_LOCAL_AUTO));
cl_assert_equal_i(true, git_clone__should_clone_local(buf.ptr, GIT_CLONE_LOCAL));
cl_assert_equal_i(true, git_clone__should_clone_local(buf.ptr, GIT_CLONE_LOCAL_NO_LINKS));
cl_assert_equal_i(false, git_clone__should_clone_local(buf.ptr, GIT_CLONE_NO_LOCAL));
git_buf_free(&buf);
path = cl_fixture("testrepo.git");
cl_assert_equal_i(true, git_clone__should_clone_local(path, GIT_CLONE_LOCAL_AUTO));
cl_assert_equal_i(true, git_clone__should_clone_local(path, GIT_CLONE_LOCAL));
cl_assert_equal_i(true, git_clone__should_clone_local(path, GIT_CLONE_LOCAL_NO_LINKS));
cl_assert_equal_i(false, git_clone__should_clone_local(path, GIT_CLONE_NO_LOCAL));
}