@@ -441,6 +441,52 @@ void test_index_addall__callback_filtering(void)
441441 git_index_free (index );
442442}
443443
444+ void test_index_addall__handles_ignored_files_in_directory (void )
445+ {
446+ git_index * index ;
447+
448+ g_repo = cl_git_sandbox_init_new (TEST_DIR );
449+
450+ cl_git_mkfile (TEST_DIR "/file.foo" , "a file" );
451+ cl_git_mkfile (TEST_DIR "/file.bar" , "another file" );
452+ cl_must_pass (p_mkdir (TEST_DIR "/folder" , 0777 ));
453+ cl_git_mkfile (TEST_DIR "/folder/asdf" , "yet another file" );
454+
455+ cl_git_mkfile (TEST_DIR "/.gitignore" , "folder/\n" );
456+
457+ check_status (g_repo , 0 , 0 , 0 , 3 , 0 , 0 , 1 , 0 );
458+
459+ cl_git_pass (git_repository_index (& index , g_repo ));
460+ cl_git_pass (git_index_add_all (index , NULL , 0 , NULL , NULL ));
461+
462+ check_status (g_repo , 3 , 0 , 0 , 0 , 0 , 0 , 1 , 0 );
463+
464+ git_index_free (index );
465+ }
466+
467+ void test_index_addall__force_adds_ignored_directories (void )
468+ {
469+ git_index * index ;
470+
471+ g_repo = cl_git_sandbox_init_new (TEST_DIR );
472+
473+ cl_git_mkfile (TEST_DIR "/file.foo" , "a file" );
474+ cl_git_mkfile (TEST_DIR "/file.bar" , "another file" );
475+ cl_must_pass (p_mkdir (TEST_DIR "/folder" , 0777 ));
476+ cl_git_mkfile (TEST_DIR "/folder/asdf" , "yet another file" );
477+
478+ cl_git_mkfile (TEST_DIR "/.gitignore" , "folder/\n" );
479+
480+ check_status (g_repo , 0 , 0 , 0 , 3 , 0 , 0 , 1 , 0 );
481+
482+ cl_git_pass (git_repository_index (& index , g_repo ));
483+ cl_git_pass (git_index_add_all (index , NULL , GIT_INDEX_ADD_FORCE , NULL , NULL ));
484+
485+ check_status (g_repo , 4 , 0 , 0 , 0 , 0 , 0 , 0 , 0 );
486+
487+ git_index_free (index );
488+ }
489+
444490void test_index_addall__adds_conflicts (void )
445491{
446492 git_index * index ;
0 commit comments