summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2014-05-28 10:07:23 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2014-05-28 15:40:22 +0200
commitc1dbfcbb4a5ca92ae90f1bdb7004edb2eb86284c (patch)
treedbfab62df7828e493829ca99af855a507c39450f
parent121b26738e6a5e6eadeb2a2bc666956ae21cb92b (diff)
downloadlibgit2-c1dbfcbb4a5ca92ae90f1bdb7004edb2eb86284c.tar.gz
clone: add flag not to link
-rw-r--r--include/git2/clone.h1
-rw-r--r--src/clone.c2
-rw-r--r--tests/clone/local.c2
3 files changed, 4 insertions, 1 deletions
diff --git a/include/git2/clone.h b/include/git2/clone.h
index 71e8e72f2..31bb52ccd 100644
--- a/include/git2/clone.h
+++ b/include/git2/clone.h
@@ -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;
/**
diff --git a/src/clone.c b/src/clone.c
index 58430f63a..c02ca04b4 100644
--- a/src/clone.c
+++ b/src/clone.c
@@ -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;
diff --git a/tests/clone/local.c b/tests/clone/local.c
index 478bbb673..7b273b23a 100644
--- a/tests/clone/local.c
+++ b/tests/clone/local.c
@@ -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));
}