@@ -71,6 +71,38 @@ void test_object_tree_update__remove_blob_deeper(void)
71
71
git_tree_free (base_tree );
72
72
}
73
73
74
+ void test_object_tree_update__remove_all_entries (void )
75
+ {
76
+ git_oid tree_index_id , tree_updater_id , base_id ;
77
+ git_tree * base_tree ;
78
+ git_index * idx ;
79
+ const char * path1 = "subdir/subdir2/README" ;
80
+ const char * path2 = "subdir/subdir2/new.txt" ;
81
+
82
+ git_tree_update updates [] = {
83
+ { GIT_TREE_UPDATE_REMOVE , {{0 }}, GIT_FILEMODE_BLOB /* ignored */ , path1 },
84
+ { GIT_TREE_UPDATE_REMOVE , {{0 }}, GIT_FILEMODE_BLOB /* ignored */ , path2 },
85
+ };
86
+
87
+ cl_git_pass (git_oid_fromstr (& base_id , "c4dc1555e4d4fa0e0c9c3fc46734c7c35b3ce90b" ));
88
+ cl_git_pass (git_tree_lookup (& base_tree , g_repo , & base_id ));
89
+
90
+ /* Create it with an index */
91
+ cl_git_pass (git_index_new (& idx ));
92
+ cl_git_pass (git_index_read_tree (idx , base_tree ));
93
+ cl_git_pass (git_index_remove (idx , path1 , 0 ));
94
+ cl_git_pass (git_index_remove (idx , path2 , 0 ));
95
+ cl_git_pass (git_index_write_tree_to (& tree_index_id , idx , g_repo ));
96
+ git_index_free (idx );
97
+
98
+ /* Perform the same operation via the tree updater */
99
+ cl_git_pass (git_tree_create_updated (& tree_updater_id , g_repo , base_tree , 2 , updates ));
100
+
101
+ cl_assert_equal_oid (& tree_index_id , & tree_updater_id );
102
+
103
+ git_tree_free (base_tree );
104
+ }
105
+
74
106
void test_object_tree_update__replace_blob (void )
75
107
{
76
108
git_oid tree_index_id , tree_updater_id , base_id ;
0 commit comments