>Can you send me patch or you send out pull request?

Below an updated version of the patch

```diff
diff --git a/tests-clar/clone/nonetwork.c b/tests-clar/clone/nonetwork.c
index c66c37d..4ae1b27 100644
--- a/tests-clar/clone/nonetwork.c
+++ b/tests-clar/clone/nonetwork.c
@@ -177,30 +177,27 @@ void test_clone_nonetwork__can_checkout_given_branch(void)
 
 void test_clone_nonetwork__can_detached_head(void)
 {
-	git_oid out;
-	git_commit *commit = NULL;
-	git_reference *ref = NULL;
+	git_object *commit;
+	git_repository *cloned;
+	git_reference *cloned_head;
 
 	cl_git_pass(git_clone(&g_repo, cl_git_fixture_url("testrepo.git"), "./foo", &g_options));
-	cl_git_pass(git_reference_name_to_id(&out, g_repo, "refs/heads/master"));
-	cl_git_pass(git_commit_lookup(&commit, g_repo, &out));
-	cl_git_pass(git_repository_set_head_detached(g_repo, git_commit_parent_id(commit, 0)));
 
-	/* remove all branch to make sure head detached */
-	git_repository_free(g_repo);
-	g_repo = NULL;
+	cl_git_pass(git_revparse_single(&commit, g_repo, "master~1"));
+	cl_git_pass(git_repository_set_head_detached(g_repo, git_object_id(commit)));
 
 	g_options.checkout_branch = NULL;
 	g_options.checkout_opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE;
-	cl_git_pass(git_clone(&g_repo, "./foo", "./foo1", &g_options));
-	cl_assert(git_repository_head_detached(g_repo));
+	cl_git_pass(git_clone(&cloned, "./foo", "./foo1", &g_options));
 
-	cl_git_pass(git_repository_head(&ref, g_repo));
-	cl_git_pass(memcmp(git_reference_target(ref), git_commit_parent_id(commit, 0), sizeof(git_oid)));
+	cl_assert(git_repository_head_detached(cloned));
+
+	cl_git_pass(git_repository_head(&cloned_head, cloned));
+	cl_assert(!git_oid_cmp(git_object_id(commit), git_reference_target(cloned_head)));
+
+	git_object_free(commit);
+	git_reference_free(cloned_head);
+	git_repository_free(cloned);
 
-	git_commit_free(commit);
-	git_reference_free(ref);
-	git_repository_free(g_repo);
-	g_repo = NULL;
 	cl_fixture_cleanup("./foo1");
 }
```