@@ -5,12 +5,12 @@ static git_repository *g_repo;
5
5
6
6
void test_object_tree_update__initialize (void )
7
7
{
8
- g_repo = cl_git_sandbox_init ("testrepo " );
8
+ g_repo = cl_git_sandbox_init ("testrepo2 " );
9
9
}
10
10
11
11
void test_object_tree_update__cleanup (void )
12
12
{
13
- cl_git_sandbox_cleanup ();
13
+ cl_git_sandbox_cleanup ();
14
14
}
15
15
16
16
void test_object_tree_update__remove_blob (void )
@@ -24,7 +24,36 @@ void test_object_tree_update__remove_blob(void)
24
24
{ GIT_TREE_UPDATE_REMOVE , {{0 }}, GIT_FILEMODE_BLOB /* ignored */ , path },
25
25
};
26
26
27
- cl_git_pass (git_oid_fromstr (& base_id , "45dd856fdd4d89b884c340ba0e047752d9b085d6" ));
27
+ cl_git_pass (git_oid_fromstr (& base_id , "c4dc1555e4d4fa0e0c9c3fc46734c7c35b3ce90b" ));
28
+ cl_git_pass (git_tree_lookup (& base_tree , g_repo , & base_id ));
29
+
30
+ /* Create it with an index */
31
+ cl_git_pass (git_index_new (& idx ));
32
+ cl_git_pass (git_index_read_tree (idx , base_tree ));
33
+ cl_git_pass (git_index_remove (idx , path , 0 ));
34
+ cl_git_pass (git_index_write_tree_to (& tree_index_id , idx , g_repo ));
35
+ git_index_free (idx );
36
+
37
+ /* Perform the same operation via the tree updater */
38
+ cl_git_pass (git_tree_create_updated (& tree_updater_id , g_repo , base_tree , 1 , updates ));
39
+
40
+ cl_assert_equal_oid (& tree_index_id , & tree_updater_id );
41
+
42
+ git_tree_free (base_tree );
43
+ }
44
+
45
+ void test_object_tree_update__remove_blob_deeper (void )
46
+ {
47
+ git_oid tree_index_id , tree_updater_id , base_id ;
48
+ git_tree * base_tree ;
49
+ git_index * idx ;
50
+ const char * path = "subdir/README" ;
51
+
52
+ git_tree_update updates [] = {
53
+ { GIT_TREE_UPDATE_REMOVE , {{0 }}, GIT_FILEMODE_BLOB /* ignored */ , path },
54
+ };
55
+
56
+ cl_git_pass (git_oid_fromstr (& base_id , "c4dc1555e4d4fa0e0c9c3fc46734c7c35b3ce90b" ));
28
57
cl_git_pass (git_tree_lookup (& base_tree , g_repo , & base_id ));
29
58
30
59
/* Create it with an index */
@@ -54,23 +83,23 @@ void test_object_tree_update__replace_blob(void)
54
83
{ GIT_TREE_UPDATE_UPSERT , {{0 }}, GIT_FILEMODE_BLOB , path },
55
84
};
56
85
57
- cl_git_pass (git_oid_fromstr (& base_id , "45dd856fdd4d89b884c340ba0e047752d9b085d6 " ));
86
+ cl_git_pass (git_oid_fromstr (& base_id , "c4dc1555e4d4fa0e0c9c3fc46734c7c35b3ce90b " ));
58
87
cl_git_pass (git_tree_lookup (& base_tree , g_repo , & base_id ));
59
88
60
89
/* Create it with an index */
61
90
cl_git_pass (git_index_new (& idx ));
62
91
cl_git_pass (git_index_read_tree (idx , base_tree ));
63
92
64
93
entry .path = path ;
65
- cl_git_pass (git_oid_fromstr (& entry .id , "3697d64be941a53d4ae8f6a271e4e3fa56b022cc " ));
94
+ cl_git_pass (git_oid_fromstr (& entry .id , "fa49b077972391ad58037050f2a75f74e3671e92 " ));
66
95
entry .mode = GIT_FILEMODE_BLOB ;
67
96
cl_git_pass (git_index_add (idx , & entry ));
68
97
69
98
cl_git_pass (git_index_write_tree_to (& tree_index_id , idx , g_repo ));
70
99
git_index_free (idx );
71
100
72
101
/* Perform the same operation via the tree updater */
73
- cl_git_pass (git_oid_fromstr (& updates [0 ].id , "3697d64be941a53d4ae8f6a271e4e3fa56b022cc " ));
102
+ cl_git_pass (git_oid_fromstr (& updates [0 ].id , "fa49b077972391ad58037050f2a75f74e3671e92 " ));
74
103
cl_git_pass (git_tree_create_updated (& tree_updater_id , g_repo , base_tree , 1 , updates ));
75
104
76
105
cl_assert_equal_oid (& tree_index_id , & tree_updater_id );
@@ -97,14 +126,14 @@ void test_object_tree_update__add_blobs(void)
97
126
{ GIT_TREE_UPDATE_UPSERT , {{0 }}, GIT_FILEMODE_BLOB , paths [2 ]},
98
127
};
99
128
100
- cl_git_pass (git_oid_fromstr (& base_id , "45dd856fdd4d89b884c340ba0e047752d9b085d6 " ));
129
+ cl_git_pass (git_oid_fromstr (& base_id , "c4dc1555e4d4fa0e0c9c3fc46734c7c35b3ce90b " ));
101
130
cl_git_pass (git_tree_lookup (& base_tree , g_repo , & base_id ));
102
131
103
132
entry .mode = GIT_FILEMODE_BLOB ;
104
- cl_git_pass (git_oid_fromstr (& entry .id , "a71586c1dfe8a71c6cbf6c129f404c5642ff31bd " ));
133
+ cl_git_pass (git_oid_fromstr (& entry .id , "fa49b077972391ad58037050f2a75f74e3671e92 " ));
105
134
106
135
for (i = 0 ; i < 3 ; i ++ ) {
107
- cl_git_pass (git_oid_fromstr (& updates [i ].id , "a71586c1dfe8a71c6cbf6c129f404c5642ff31bd " ));
136
+ cl_git_pass (git_oid_fromstr (& updates [i ].id , "fa49b077972391ad58037050f2a75f74e3671e92 " ));
108
137
}
109
138
110
139
for (i = 0 ; i < 2 ; i ++ ) {
0 commit comments