@@ -20,7 +20,7 @@ void test_index_add__cleanup(void)
20
20
cl_git_sandbox_cleanup ();
21
21
g_repo = NULL ;
22
22
23
- cl_git_pass (git_libgit2_opts (GIT_OPT_ENABLE_STRICT_OBJECT_CREATION , 0 ));
23
+ cl_git_pass (git_libgit2_opts (GIT_OPT_ENABLE_STRICT_OBJECT_CREATION , 1 ));
24
24
}
25
25
26
26
static void test_add_entry (
@@ -42,7 +42,7 @@ static void test_add_entry(
42
42
void test_index_add__invalid_entries_succeeds_by_default (void )
43
43
{
44
44
/*
45
- * Ensure that there is no validation on ids by default
45
+ * Ensure that there is validation on object ids by default
46
46
*/
47
47
48
48
/* ensure that we can add some actually good entries */
@@ -51,34 +51,34 @@ void test_index_add__invalid_entries_succeeds_by_default(void)
51
51
test_add_entry (true, valid_blob_id , GIT_FILEMODE_LINK );
52
52
53
53
/* test that we fail to add some invalid (missing) blobs and trees */
54
- test_add_entry (true , invalid_id , GIT_FILEMODE_BLOB );
55
- test_add_entry (true , invalid_id , GIT_FILEMODE_BLOB_EXECUTABLE );
56
- test_add_entry (true , invalid_id , GIT_FILEMODE_LINK );
54
+ test_add_entry (false , invalid_id , GIT_FILEMODE_BLOB );
55
+ test_add_entry (false , invalid_id , GIT_FILEMODE_BLOB_EXECUTABLE );
56
+ test_add_entry (false , invalid_id , GIT_FILEMODE_LINK );
57
57
58
58
/* test that we validate the types of objects */
59
- test_add_entry (true , valid_commit_id , GIT_FILEMODE_BLOB );
60
- test_add_entry (true , valid_tree_id , GIT_FILEMODE_BLOB_EXECUTABLE );
61
- test_add_entry (true , valid_commit_id , GIT_FILEMODE_LINK );
59
+ test_add_entry (false , valid_commit_id , GIT_FILEMODE_BLOB );
60
+ test_add_entry (false , valid_tree_id , GIT_FILEMODE_BLOB_EXECUTABLE );
61
+ test_add_entry (false , valid_commit_id , GIT_FILEMODE_LINK );
62
62
63
63
/*
64
- * Ensure that strict object references will fail the `index_add`
64
+ * Ensure that there we can disable validation
65
65
*/
66
66
67
- cl_git_pass (git_libgit2_opts (GIT_OPT_ENABLE_STRICT_OBJECT_CREATION , 1 ));
67
+ cl_git_pass (git_libgit2_opts (GIT_OPT_ENABLE_STRICT_OBJECT_CREATION , 0 ));
68
68
69
69
/* ensure that we can add some actually good entries */
70
70
test_add_entry (true, valid_blob_id , GIT_FILEMODE_BLOB );
71
71
test_add_entry (true, valid_blob_id , GIT_FILEMODE_BLOB_EXECUTABLE );
72
72
test_add_entry (true, valid_blob_id , GIT_FILEMODE_LINK );
73
73
74
- /* test that we fail to add some invalid (missing) blobs and trees */
75
- test_add_entry (false , invalid_id , GIT_FILEMODE_BLOB );
76
- test_add_entry (false , invalid_id , GIT_FILEMODE_BLOB_EXECUTABLE );
77
- test_add_entry (false , invalid_id , GIT_FILEMODE_LINK );
74
+ /* test that we can now add some invalid (missing) blobs and trees */
75
+ test_add_entry (true , invalid_id , GIT_FILEMODE_BLOB );
76
+ test_add_entry (true , invalid_id , GIT_FILEMODE_BLOB_EXECUTABLE );
77
+ test_add_entry (true , invalid_id , GIT_FILEMODE_LINK );
78
78
79
- /* test that we validate the types of objects */
80
- test_add_entry (false , valid_commit_id , GIT_FILEMODE_BLOB );
81
- test_add_entry (false , valid_tree_id , GIT_FILEMODE_BLOB_EXECUTABLE );
82
- test_add_entry (false , valid_commit_id , GIT_FILEMODE_LINK );
79
+ /* test that we do not validate the types of objects */
80
+ test_add_entry (true , valid_commit_id , GIT_FILEMODE_BLOB );
81
+ test_add_entry (true , valid_tree_id , GIT_FILEMODE_BLOB_EXECUTABLE );
82
+ test_add_entry (true , valid_commit_id , GIT_FILEMODE_LINK );
83
83
}
84
84
0 commit comments