Commit d22a8b95 by Edward Thomson

refs::create: strict object creation on by default

When we turned strict object creation validation on by default, we
forgot to inform the refs::create tests of this.  They, in fact,
believed that strict object creation was off by default.  As a result,
their cleanup function went and turned strict object creation off for
the remaining tests.
parent 6d22ef7a
...@@ -19,7 +19,7 @@ void test_refs_create__cleanup(void) ...@@ -19,7 +19,7 @@ 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, 0)); cl_git_pass(git_libgit2_opts(GIT_OPT_ENABLE_STRICT_OBJECT_CREATION, 1));
} }
void test_refs_create__symbolic(void) void test_refs_create__symbolic(void)
...@@ -122,7 +122,7 @@ void test_refs_create__oid(void) ...@@ -122,7 +122,7 @@ void test_refs_create__oid(void)
} }
/* Can by default create a reference that targets at an unknown id */ /* Can by default create a reference that targets at an unknown id */
void test_refs_create__oid_unknown_succeeds_by_default(void) void test_refs_create__oid_unknown_succeeds_without_strict(void)
{ {
git_reference *new_reference, *looked_up_ref; git_reference *new_reference, *looked_up_ref;
git_oid id; git_oid id;
...@@ -131,6 +131,8 @@ void test_refs_create__oid_unknown_succeeds_by_default(void) ...@@ -131,6 +131,8 @@ void test_refs_create__oid_unknown_succeeds_by_default(void)
git_oid_fromstr(&id, "deadbeef3f795b2b4353bcce3a527ad0a4f7f644"); git_oid_fromstr(&id, "deadbeef3f795b2b4353bcce3a527ad0a4f7f644");
cl_git_pass(git_libgit2_opts(GIT_OPT_ENABLE_STRICT_OBJECT_CREATION, 0));
/* Create and write the new object id reference */ /* Create and write the new object id reference */
cl_git_pass(git_reference_create(&new_reference, g_repo, new_head, &id, 0, NULL)); cl_git_pass(git_reference_create(&new_reference, g_repo, new_head, &id, 0, NULL));
git_reference_free(new_reference); git_reference_free(new_reference);
...@@ -141,7 +143,7 @@ void test_refs_create__oid_unknown_succeeds_by_default(void) ...@@ -141,7 +143,7 @@ void test_refs_create__oid_unknown_succeeds_by_default(void)
} }
/* Strict object enforcement enforces valid object id */ /* Strict object enforcement enforces valid object id */
void test_refs_create__oid_unknown_fails_strict_mode(void) void test_refs_create__oid_unknown_fails_by_default(void)
{ {
git_reference *new_reference, *looked_up_ref; git_reference *new_reference, *looked_up_ref;
git_oid id; git_oid id;
...@@ -150,8 +152,6 @@ void test_refs_create__oid_unknown_fails_strict_mode(void) ...@@ -150,8 +152,6 @@ void test_refs_create__oid_unknown_fails_strict_mode(void)
git_oid_fromstr(&id, "deadbeef3f795b2b4353bcce3a527ad0a4f7f644"); git_oid_fromstr(&id, "deadbeef3f795b2b4353bcce3a527ad0a4f7f644");
cl_git_pass(git_libgit2_opts(GIT_OPT_ENABLE_STRICT_OBJECT_CREATION, 1));
/* Create and write the new object id reference */ /* Create and write the new object id reference */
cl_git_fail(git_reference_create(&new_reference, g_repo, new_head, &id, 0, NULL)); cl_git_fail(git_reference_create(&new_reference, g_repo, new_head, &id, 0, NULL));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment