Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2015-08-11 21:44:19 +0300
committerCarlos Martín Nieto <cmn@dwim.me>2015-08-11 21:44:19 +0300
commita879276783de5cc2c82543a9f930337f000aa8e5 (patch)
tree45fbc461375ebedfd17560e75f7161b81c7d732f
parent98f7bd289dfb172473b7d7353d4b0f0b09c67937 (diff)
remote: add failing test for a mirror refspec
While we download the remote's remote-tracking branches, we don't download the tag. This points to the tag auto-follow rules interfering with the refspec.
-rw-r--r--tests/network/fetchlocal.c39
1 files changed, 34 insertions, 5 deletions
diff --git a/tests/network/fetchlocal.c b/tests/network/fetchlocal.c
index 06ee3dd36..17c8f26e3 100644
--- a/tests/network/fetchlocal.c
+++ b/tests/network/fetchlocal.c
@@ -369,17 +369,46 @@ void test_network_fetchlocal__clone_into_mirror(void)
{
git_clone_options opts = GIT_CLONE_OPTIONS_INIT;
git_repository *repo;
- git_reference *head;
+ git_reference *ref;
opts.bare = true;
opts.remote_cb = remote_mirror_cb;
cl_git_pass(git_clone(&repo, cl_git_fixture_url("testrepo.git"), "./foo.git", &opts));
- cl_git_pass(git_reference_lookup(&head, repo, "HEAD"));
- cl_assert_equal_i(GIT_REF_SYMBOLIC, git_reference_type(head));
- cl_assert_equal_s("refs/heads/master", git_reference_symbolic_target(head));
+ cl_git_pass(git_reference_lookup(&ref, repo, "HEAD"));
+ cl_assert_equal_i(GIT_REF_SYMBOLIC, git_reference_type(ref));
+ cl_assert_equal_s("refs/heads/master", git_reference_symbolic_target(ref));
+
+ git_reference_free(ref);
+ cl_git_pass(git_reference_lookup(&ref, repo, "refs/remotes/test/master"));
+
+ git_reference_free(ref);
+ git_repository_free(repo);
+ cl_fixture_cleanup("./foo.git");
+}
- git_reference_free(head);
+void test_network_fetchlocal__all_refs(void)
+{
+ git_repository *repo;
+ git_remote *remote;
+ git_reference *ref;
+ char *allrefs = "+refs/*:refs/*";
+ git_strarray refspecs = {
+ &allrefs,
+ 1,
+ };
+
+ cl_git_pass(git_repository_init(&repo, "./foo.git", true));
+ cl_git_pass(git_remote_create_anonymous(&remote, repo, cl_git_fixture_url("testrepo.git")));
+ cl_git_pass(git_remote_fetch(remote, &refspecs, NULL, NULL));
+
+ cl_git_pass(git_reference_lookup(&ref, repo, "refs/remotes/test/master"));
+ git_reference_free(ref);
+
+ cl_git_pass(git_reference_lookup(&ref, repo, "refs/tags/test"));
+ git_reference_free(ref);
+
+ git_remote_free(remote);
git_repository_free(repo);
cl_fixture_cleanup("./foo.git");
}