Merge pull request #3737 from ethomson/strict-object Strict object creation in `refs::create`
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
diff --git a/tests/refs/create.c b/tests/refs/create.c
index b96d0c9..6d5a5f1 100644
--- a/tests/refs/create.c
+++ b/tests/refs/create.c
@@ -19,7 +19,7 @@ void test_refs_create__cleanup(void)
{
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)
@@ -122,7 +122,7 @@ void test_refs_create__oid(void)
}
/* 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_oid id;
@@ -131,6 +131,8 @@ void test_refs_create__oid_unknown_succeeds_by_default(void)
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 */
cl_git_pass(git_reference_create(&new_reference, g_repo, new_head, &id, 0, NULL));
git_reference_free(new_reference);
@@ -141,7 +143,7 @@ void test_refs_create__oid_unknown_succeeds_by_default(void)
}
/* 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_oid id;
@@ -150,8 +152,6 @@ void test_refs_create__oid_unknown_fails_strict_mode(void)
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 */
cl_git_fail(git_reference_create(&new_reference, g_repo, new_head, &id, 0, NULL));
diff --git a/tests/reset/hard.c b/tests/reset/hard.c
index 0c0af91..e461f80 100644
--- a/tests/reset/hard.c
+++ b/tests/reset/hard.c
@@ -122,9 +122,9 @@ static void unmerged_index_init(git_index *index, int entries)
int write_theirs = 4;
git_oid ancestor, ours, theirs;
- git_oid_fromstr(&ancestor, "6bb0d9f700543ba3d318ba7075fc3bd696b4287b");
- git_oid_fromstr(&ours, "b19a1e93bec1317dc6097229e12afaffbfa74dc2");
- git_oid_fromstr(&theirs, "950b81b7eee953d050aa05a641f8e056c85dd1bd");
+ git_oid_fromstr(&ancestor, "452e4244b5d083ddf0460acf1ecc74db9dcfa11a");
+ git_oid_fromstr(&ours, "32504b727382542f9f089e24fddac5e78533e96c");
+ git_oid_fromstr(&theirs, "061d42a44cacde5726057b67558821d95db96f19");
cl_git_rewritefile("status/conflicting_file", "conflicting file\n");