Merge pull request #4143 from richardipsum/issue-4094

Fix: make reflog include "(merge)" for merge commits
diff --git a/CONVENTIONS.md b/CONVENTIONS.md
index 0be4b33..ffb696a 100644
--- a/CONVENTIONS.md
+++ b/CONVENTIONS.md
@@ -18,11 +18,11 @@
  - If a function returns an object as a return value, that function is
    a getter and the object's lifetime is tied to the parent
    object. Objects which are returned as the first argument as a
-   pointer-to-pointer are owned by the caller and it is repsponsible
+   pointer-to-pointer are owned by the caller and it is responsible
    for freeing it. Strings are returned via `git_buf` in order to
    allow for re-use and safe freeing.
 
- - Most of what libgit2 does relates to I/O so you as a general rule
+ - Most of what libgit2 does relates to I/O so as a general rule
    you should assume that any function can fail due to errors as even
    getting data from the filesystem can result in all sorts of errors
    and complex failure cases.
diff --git a/tests/core/posix.c b/tests/core/posix.c
index 26ae360..018d0c8 100644
--- a/tests/core/posix.c
+++ b/tests/core/posix.c
@@ -94,10 +94,10 @@
 	cl_assert(p_inet_pton(AF_INET, "10.foo.bar.1", &addr) == 0);
 
 	/* Test unsupported address families */
-	cl_git_fail(p_inet_pton(12, "52.472", NULL)); /* AF_DECnet */
+	cl_git_fail(p_inet_pton(12, "52.472", &addr)); /* AF_DECnet */
 	cl_assert_equal_i(EAFNOSUPPORT, errno);
 
-	cl_git_fail(p_inet_pton(5, "315.124", NULL)); /* AF_CHAOS */
+	cl_git_fail(p_inet_pton(5, "315.124", &addr)); /* AF_CHAOS */
 	cl_assert_equal_i(EAFNOSUPPORT, errno);
 }
 
diff --git a/tests/refs/create.c b/tests/refs/create.c
index 6d5a5f1..db6f887 100644
--- a/tests/refs/create.c
+++ b/tests/refs/create.c
@@ -12,19 +12,20 @@
 
 void test_refs_create__initialize(void)
 {
-   g_repo = cl_git_sandbox_init("testrepo");
+	g_repo = cl_git_sandbox_init("testrepo");
 }
 
 void test_refs_create__cleanup(void)
 {
-   cl_git_sandbox_cleanup();
+	cl_git_sandbox_cleanup();
 
 	cl_git_pass(git_libgit2_opts(GIT_OPT_ENABLE_STRICT_OBJECT_CREATION, 1));
+	cl_git_pass(git_libgit2_opts(GIT_OPT_ENABLE_STRICT_SYMBOLIC_REF_CREATION, 1));
 }
 
 void test_refs_create__symbolic(void)
 {
-   // create a new symbolic reference
+	/* create a new symbolic reference */
 	git_reference *new_reference, *looked_up_ref, *resolved_ref;
 	git_repository *repo2;
 	git_oid id;
@@ -65,9 +66,57 @@
 	git_reference_free(resolved_ref);
 }
 
+void test_refs_create__symbolic_with_arbitrary_content(void)
+{
+	git_reference *new_reference, *looked_up_ref;
+	git_repository *repo2;
+	git_oid id;
+
+	const char *new_head_tracker = "ANOTHER_HEAD_TRACKER";
+	const char *arbitrary_target = "ARBITRARY DATA";
+
+	git_oid_fromstr(&id, current_master_tip);
+
+	/* Attempt to create symbolic ref with arbitrary data in target
+	 * fails by default
+	 */
+	cl_git_fail(git_reference_symbolic_create(&new_reference, g_repo, new_head_tracker, arbitrary_target, 0, NULL));
+
+	git_libgit2_opts(GIT_OPT_ENABLE_STRICT_SYMBOLIC_REF_CREATION, 0);
+
+	/* With strict target validation disabled, ref creation succeeds */
+	cl_git_pass(git_reference_symbolic_create(&new_reference, g_repo, new_head_tracker, arbitrary_target, 0, NULL));
+
+	/* Ensure the reference can be looked-up... */
+	cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, new_head_tracker));
+	cl_assert(git_reference_type(looked_up_ref) & GIT_REF_SYMBOLIC);
+	cl_assert(reference_is_packed(looked_up_ref) == 0);
+	cl_assert_equal_s(looked_up_ref->name, new_head_tracker);
+
+	/* Ensure the target is what we expect it to be */
+	cl_assert_equal_s(git_reference_symbolic_target(new_reference), arbitrary_target);
+
+	/* Similar test with a fresh new repository object */
+	cl_git_pass(git_repository_open(&repo2, "testrepo"));
+
+	/* Ensure the reference can be looked-up... */
+	cl_git_pass(git_reference_lookup(&looked_up_ref, repo2, new_head_tracker));
+	cl_assert(git_reference_type(looked_up_ref) & GIT_REF_SYMBOLIC);
+	cl_assert(reference_is_packed(looked_up_ref) == 0);
+	cl_assert_equal_s(looked_up_ref->name, new_head_tracker);
+
+	/* Ensure the target is what we expect it to be */
+	cl_assert_equal_s(git_reference_symbolic_target(new_reference), arbitrary_target);
+
+	git_repository_free(repo2);
+	git_reference_free(new_reference);
+	git_reference_free(looked_up_ref);
+
+}
+
 void test_refs_create__deep_symbolic(void)
 {
-   // create a deep symbolic reference
+	/* create a deep symbolic reference */
 	git_reference *new_reference, *looked_up_ref, *resolved_ref;
 	git_oid id;
 
@@ -87,7 +136,7 @@
 
 void test_refs_create__oid(void)
 {
-   // create a new OID reference
+	/* create a new OID reference */
 	git_reference *new_reference, *looked_up_ref;
 	git_repository *repo2;
 	git_oid id;