@@ -422,6 +422,44 @@ void test_checkout_tree__can_checkout_with_pattern(void)
422
422
cl_assert (git_path_exists ("testrepo/new.txt" ));
423
423
}
424
424
425
+ void test_checkout_tree__pathlist_checkout_ignores_non_matches (void )
426
+ {
427
+ char * entries [] = { "branch_file.txt" , "link_to_new.txt" };
428
+
429
+ /* reset to beginning of history (i.e. just a README file) */
430
+
431
+ g_opts .checkout_strategy =
432
+ GIT_CHECKOUT_FORCE | GIT_CHECKOUT_REMOVE_UNTRACKED ;
433
+
434
+ cl_git_pass (git_revparse_single (& g_object , g_repo , "refs/heads/master" ));
435
+
436
+ cl_git_pass (git_checkout_tree (g_repo , g_object , & g_opts ));
437
+ cl_git_pass (git_repository_set_head (g_repo , "refs/heads/master" ));
438
+
439
+ cl_assert (git_path_exists ("testrepo/README" ));
440
+ cl_assert (git_path_exists ("testrepo/branch_file.txt" ));
441
+ cl_assert (git_path_exists ("testrepo/link_to_new.txt" ));
442
+ cl_assert (git_path_exists ("testrepo/new.txt" ));
443
+
444
+ cl_git_pass (git_revparse_single (& g_object , g_repo , "8496071c1b46c854b31185ea97743be6a8774479" ));
445
+
446
+ g_opts .checkout_strategy =
447
+ GIT_CHECKOUT_FORCE | GIT_CHECKOUT_DISABLE_PATHSPEC_MATCH ;
448
+ g_opts .paths .strings = entries ;
449
+ g_opts .paths .count = 2 ;
450
+
451
+ cl_git_pass (git_checkout_tree (g_repo , g_object , & g_opts ));
452
+
453
+ cl_assert (git_path_exists ("testrepo/README" ));
454
+ cl_assert (!git_path_exists ("testrepo/branch_file.txt" ));
455
+ cl_assert (!git_path_exists ("testrepo/link_to_new.txt" ));
456
+ cl_assert (git_path_exists ("testrepo/new.txt" ));
457
+
458
+ git_object_free (g_object );
459
+ g_object = NULL ;
460
+
461
+ }
462
+
425
463
void test_checkout_tree__can_disable_pattern_match (void )
426
464
{
427
465
char * entries [] = { "b*.txt" };
0 commit comments