]> git.proxmox.com Git - libgit2.git/blame - tests/clone/local.c
fileops: allow linking files when copying directory structures
[libgit2.git] / tests / clone / local.c
CommitLineData
121b2673
CMN
1#include "clar_libgit2.h"
2
3#include "git2/clone.h"
4#include "clone.h"
5#include "buffer.h"
6
7void assert_clone(const char *path, git_clone_local_t opt, int val)
8{
9 cl_assert_equal_i(val, git_clone__should_clone_local(path, opt));
10}
11
12void test_clone_local__should_clone_local(void)
13{
14 git_buf buf = GIT_BUF_INIT;
15 const char *path;
16
17 /* we use a fixture path because it needs to exist for us to want to clone */
18
19 cl_git_pass(git_buf_printf(&buf, "file://%s", cl_fixture("testrepo.git")));
20 cl_assert_equal_i(false, git_clone__should_clone_local(buf.ptr, GIT_CLONE_LOCAL_AUTO));
21 cl_assert_equal_i(true, git_clone__should_clone_local(buf.ptr, GIT_CLONE_LOCAL));
c1dbfcbb 22 cl_assert_equal_i(true, git_clone__should_clone_local(buf.ptr, GIT_CLONE_LOCAL_NO_LINKS));
121b2673
CMN
23 cl_assert_equal_i(false, git_clone__should_clone_local(buf.ptr, GIT_CLONE_NO_LOCAL));
24 git_buf_free(&buf);
25
26 path = cl_fixture("testrepo.git");
27 cl_assert_equal_i(true, git_clone__should_clone_local(path, GIT_CLONE_LOCAL_AUTO));
28 cl_assert_equal_i(true, git_clone__should_clone_local(path, GIT_CLONE_LOCAL));
c1dbfcbb 29 cl_assert_equal_i(true, git_clone__should_clone_local(path, GIT_CLONE_LOCAL_NO_LINKS));
121b2673
CMN
30 cl_assert_equal_i(false, git_clone__should_clone_local(path, GIT_CLONE_NO_LOCAL));
31}