@@ -1290,3 +1290,47 @@ void test_ignore_status__leading_spaces_are_significant(void)
12901290 assert_is_ignored (" # not a comment" );
12911291 assert_is_ignored ("d.test" );
12921292}
1293+
1294+ void test_ignore_status__override_nested_wildcard_unignore (void )
1295+ {
1296+ git_repository * repo = cl_git_sandbox_init ("empty_standard_repo" );
1297+ git_status_list * statuslist ;
1298+ git_status_options opts = GIT_STATUS_OPTIONS_INIT ;
1299+ const git_status_entry * status ;
1300+
1301+ cl_git_pass (git_futils_mkdir_r ("empty_standard_repo/dir" , 0777 ));
1302+ cl_git_pass (git_futils_mkdir_r ("empty_standard_repo/dir/subdir" , 0777 ));
1303+ cl_git_mkfile ("empty_standard_repo/.gitignore" , "a.test\n" );
1304+ cl_git_mkfile ("empty_standard_repo/dir/.gitignore" , "!*.test\n" );
1305+ cl_git_mkfile ("empty_standard_repo/dir/subdir/.gitignore" , "a.test\n" );
1306+ cl_git_mkfile ("empty_standard_repo/dir/a.test" , "pong" );
1307+ cl_git_mkfile ("empty_standard_repo/dir/subdir/a.test" , "pong" );
1308+
1309+ opts .show = GIT_STATUS_SHOW_INDEX_AND_WORKDIR ;
1310+ opts .flags = GIT_STATUS_OPT_INCLUDE_UNTRACKED | GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS ;
1311+
1312+ cl_git_pass (git_status_list_new (& statuslist , repo , & opts ));
1313+ cl_assert_equal_sz (4 , git_status_list_entrycount (statuslist ));
1314+
1315+ status = git_status_byindex (statuslist , 0 );
1316+ cl_assert (status != NULL );
1317+ cl_assert_equal_s (".gitignore" , status -> index_to_workdir -> old_file .path );
1318+ cl_assert_equal_i (GIT_STATUS_WT_NEW , status -> status );
1319+
1320+ status = git_status_byindex (statuslist , 1 );
1321+ cl_assert (status != NULL );
1322+ cl_assert_equal_s ("dir/.gitignore" , status -> index_to_workdir -> old_file .path );
1323+ cl_assert_equal_i (GIT_STATUS_WT_NEW , status -> status );
1324+
1325+ status = git_status_byindex (statuslist , 2 );
1326+ cl_assert (status != NULL );
1327+ cl_assert_equal_s ("dir/a.test" , status -> index_to_workdir -> old_file .path );
1328+ cl_assert_equal_i (GIT_STATUS_WT_NEW , status -> status );
1329+
1330+ status = git_status_byindex (statuslist , 3 );
1331+ cl_assert (status != NULL );
1332+ cl_assert_equal_s ("dir/subdir/.gitignore" , status -> index_to_workdir -> old_file .path );
1333+ cl_assert_equal_i (GIT_STATUS_WT_NEW , status -> status );
1334+
1335+ git_status_list_free (statuslist );
1336+ }
0 commit comments