File tree 1 file changed +23
-0
lines changed
1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -103,3 +103,26 @@ void test_index_read_index__produces_treesame_indexes(void)
103
103
roundtrip_with_read_index ("fd093bff70906175335656e6ce6ae05783708765" );
104
104
roundtrip_with_read_index ("ae90f12eea699729ed24555e40b9fd669da12a12" );
105
105
}
106
+
107
+ void test_index_read_index__read_and_writes (void )
108
+ {
109
+ git_oid tree_id , new_tree_id ;
110
+ git_tree * tree ;
111
+ git_index * tree_index , * new_index ;
112
+
113
+ cl_git_pass (git_oid_fromstr (& tree_id , "ae90f12eea699729ed24555e40b9fd669da12a12" ));
114
+ cl_git_pass (git_tree_lookup (& tree , _repo , & tree_id ));
115
+ cl_git_pass (git_index_new (& tree_index ));
116
+ cl_git_pass (git_index_read_tree (tree_index , tree ));
117
+ cl_git_pass (git_index_read_index (_index , tree_index ));
118
+ cl_git_pass (git_index_write (_index ));
119
+
120
+ cl_git_pass (git_index_open (& new_index , git_index_path (_index )));
121
+ cl_git_pass (git_index_write_tree_to (& new_tree_id , new_index , _repo ));
122
+
123
+ cl_assert_equal_oid (& tree_id , & new_tree_id );
124
+
125
+ git_tree_free (tree );
126
+ git_index_free (tree_index );
127
+ git_index_free (new_index );
128
+ }
You can’t perform that action at this time.
0 commit comments