mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-02 21:34:15 +00:00
clone: add flag not to link
This commit is contained in:
parent
121b26738e
commit
c1dbfcbb4a
@ -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;
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
|
@ -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));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user