From c1dbfcbb4a5ca92ae90f1bdb7004edb2eb86284c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Wed, 28 May 2014 10:07:23 +0200 Subject: [PATCH] clone: add flag not to link --- include/git2/clone.h | 1 + src/clone.c | 2 +- tests/clone/local.c | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) 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)); }