summaryrefslogtreecommitdiff
path: root/tests/libgit2/online
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2022-09-16 14:27:13 -0400
committerEdward Thomson <ethomson@edwardthomson.com>2022-09-19 05:07:16 -0400
commit9d9a90ad3d64d54948b736f6866a82c6670b61c1 (patch)
tree178e4a322179fdf37331f5d9b40a8701d55e6a35 /tests/libgit2/online
parentc928d96ea40a83713aaac523cd6e6bd5b5fb7490 (diff)
downloadlibgit2-9d9a90ad3d64d54948b736f6866a82c6670b61c1.tar.gz
clone: test bare clone namespaced repo with no HEAD
Test that we can successfully clone a repository that is namespace scoped to a bare repository locally. We need not specify a checkout branch in this case (obviously, since we do not check anything out in a bare clone).
Diffstat (limited to 'tests/libgit2/online')
-rw-r--r--tests/libgit2/online/clone.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/libgit2/online/clone.c b/tests/libgit2/online/clone.c
index 6a087b1af..fd8fb17ea 100644
--- a/tests/libgit2/online/clone.c
+++ b/tests/libgit2/online/clone.c
@@ -1006,3 +1006,22 @@ void test_online_clone__redirect_initial_fails_for_subsequent(void)
cl_git_fail(git_clone(&g_repo, _remote_redirect_subsequent, "./fail", &options));
}
+
+void test_online_clone__namespace_bare(void)
+{
+ git_clone_options options = GIT_CLONE_OPTIONS_INIT;
+ git_reference *head;
+
+ if (!_remote_url)
+ cl_skip();
+
+ options.bare = true;
+
+ cl_git_pass(git_clone(&g_repo, _remote_url, "./namespaced.git", &options));
+
+ cl_git_pass(git_reference_lookup(&head, g_repo, GIT_HEAD_FILE));
+ cl_assert_equal_i(GIT_REFERENCE_SYMBOLIC, git_reference_type(head));
+ cl_assert_equal_s("refs/heads/master", git_reference_symbolic_target(head));
+
+ git_reference_free(head);
+}