1
1
#include "clar_libgit2.h"
2
2
#include "futils.h"
3
3
#include "git2/attr.h"
4
+ #include "attr_file.h"
4
5
#include "sparse.h"
5
6
#include "status/status_helpers.h"
6
7
@@ -71,8 +72,6 @@ void test_sparse_status__cache_attr(void)
71
72
git_sparse_checkout_init_options scopts = GIT_SPARSE_CHECKOUT_INIT_OPTIONS_INIT ;
72
73
g_repo = cl_git_sandbox_init ("sparse" );
73
74
74
- clar__skip ();
75
-
76
75
cl_git_pass (git_sparse_checkout_init (g_repo , & scopts ));
77
76
78
77
git_attr_cache_flush (g_repo );
@@ -227,14 +226,30 @@ void test_sparse_status__append_file(void)
227
226
assert_checkout (one_test -> expected , one_test -> path );
228
227
}
229
228
229
+ void test_sparse_status__reapply (void )
230
+ {
231
+ status_entry_single st ;
232
+ git_sparse_checkout_init_options scopts = GIT_SPARSE_CHECKOUT_INIT_OPTIONS_INIT ;
233
+ g_repo = cl_git_sandbox_init ("sparse" );
234
+
235
+ cl_assert (git_fs_path_exists ("sparse/file1" ));
236
+ cl_assert (git_fs_path_exists ("sparse/a/file3" ));
237
+
238
+ cl_git_pass (git_sparse_checkout_init (g_repo , & scopts ));
239
+
240
+ cl_assert (git_fs_path_exists ("sparse/file1" ));
241
+ cl_assert (!git_fs_path_exists ("sparse/a/file3" ));
242
+ }
230
243
231
244
void test_sparse_status__clean (void )
232
245
{
233
246
status_entry_single st ;
234
247
git_sparse_checkout_init_options scopts = GIT_SPARSE_CHECKOUT_INIT_OPTIONS_INIT ;
235
248
g_repo = cl_git_sandbox_init ("sparse" );
236
249
237
- clar__skip ();
250
+ memset (& st , 0 , sizeof (st ));
251
+ cl_git_pass (git_status_foreach (g_repo , cb_status__single , & st ));
252
+ cl_assert_equal_i (0 , st .count );
238
253
239
254
cl_git_pass (git_sparse_checkout_init (g_repo , & scopts ));
240
255
@@ -266,8 +281,6 @@ void test_sparse_status__new_file(void)
266
281
git_sparse_checkout_init_options scopts = GIT_SPARSE_CHECKOUT_INIT_OPTIONS_INIT ;
267
282
g_repo = cl_git_sandbox_init ("sparse" );
268
283
269
- clar__skip ();
270
-
271
284
cl_git_pass (git_sparse_checkout_init (g_repo , & scopts ));
272
285
273
286
cl_git_mkfile ("sparse/newfile" , "/hello world\n" );
@@ -285,8 +298,6 @@ void test_sparse_status__new_file_new_folder(void)
285
298
git_sparse_checkout_init_options scopts = GIT_SPARSE_CHECKOUT_INIT_OPTIONS_INIT ;
286
299
g_repo = cl_git_sandbox_init ("sparse" );
287
300
288
- clar__skip ();
289
-
290
301
cl_git_pass (git_sparse_checkout_init (g_repo , & scopts ));
291
302
292
303
cl_must_pass (git_futils_mkdir ("sparse/new" , 0777 , 0 ));
@@ -305,8 +316,6 @@ void test_sparse_status__new_file_sparse_folder(void)
305
316
git_sparse_checkout_init_options scopts = GIT_SPARSE_CHECKOUT_INIT_OPTIONS_INIT ;
306
317
g_repo = cl_git_sandbox_init ("sparse" );
307
318
308
- clar__skip ();
309
-
310
319
cl_git_pass (git_sparse_checkout_init (g_repo , & scopts ));
311
320
312
321
cl_must_pass (git_futils_mkdir ("sparse/a" , 0777 , 0 ));
@@ -325,15 +334,13 @@ void test_sparse_status__new_sparse_file_sparse_folder(void)
325
334
git_sparse_checkout_init_options scopts = GIT_SPARSE_CHECKOUT_INIT_OPTIONS_INIT ;
326
335
g_repo = cl_git_sandbox_init ("sparse" );
327
336
328
- clar__skip ();
329
-
330
337
cl_git_pass (git_sparse_checkout_init (g_repo , & scopts ));
331
338
332
339
cl_must_pass (git_futils_mkdir ("sparse/a" , 0777 , 0 ));
333
340
cl_git_mkfile ("sparse/a/file3" , "/hello world\n" );
334
341
memset (& st , 0 , sizeof (st ));
335
342
cl_git_pass (git_status_foreach (g_repo , cb_status__single , & st ));
336
- cl_assert_equal_i (0 , st .count );
343
+ cl_assert_equal_i (1 , st .count );
337
344
338
345
refute_is_checkout ("new/newfile" );
339
346
}
0 commit comments