@@ -1584,6 +1584,14 @@ static struct bfs_expr *parse_hidden(struct bfs_parser *parser, int arg1, int ar
15841584 return parse_nullary_test (parser , eval_hidden );
15851585}
15861586
1587+ /**
1588+ * Parse -ignore-vcs.
1589+ */
1590+ static struct bfs_expr * parse_ignore_vcs (struct bfs_parser * parser , int arg1 , int arg2 ) {
1591+ parser -> ctx -> ignore_vcs = true;
1592+ return parse_nullary_option (parser );
1593+ }
1594+
15871595/**
15881596 * Parse -(no)?ignore_readdir_race.
15891597 */
@@ -2774,6 +2782,8 @@ static struct bfs_expr *parse_help(struct bfs_parser *parser, int arg1, int arg2
27742782 cfprintf (cout , " Search the NUL ('\\0')-separated paths from ${bld}FILE${rs} (${bld}-${rs} for standard input).\n" );
27752783 cfprintf (cout , " ${blu}-follow${rs}\n" );
27762784 cfprintf (cout , " Follow all symbolic links (same as ${cyn}-L${rs})\n" );
2785+ cfprintf (cout , " ${blu}-ignore_vcs${rs}\n" );
2786+ cfprintf (cout , " Ignore files and directories ignored by version control systems (e.g. git)\n" );
27772787 cfprintf (cout , " ${blu}-ignore_readdir_race${rs}\n" );
27782788 cfprintf (cout , " ${blu}-noignore_readdir_race${rs}\n" );
27792789 cfprintf (cout , " Whether to report an error if ${ex}%s${rs} detects that the file tree is modified\n" ,
@@ -3088,6 +3098,7 @@ static const struct table_entry parse_table[] = {
30883098 {"-group" , BFS_TEST , parse_group },
30893099 {"-help" , BFS_ACTION , parse_help },
30903100 {"-hidden" , BFS_TEST , parse_hidden },
3101+ {"-ignore_vcs" , BFS_OPTION , parse_ignore_vcs },
30913102 {"-ignore_readdir_race" , BFS_OPTION , parse_ignore_races , true},
30923103 {"-ilname" , BFS_TEST , parse_lname , true},
30933104 {"-iname" , BFS_TEST , parse_name , true},
@@ -3807,6 +3818,10 @@ void bfs_ctx_dump(const struct bfs_ctx *ctx, enum debug_flags flag) {
38073818 cfprintf (cerr , " ${blu}-xdev${rs}" );
38083819 }
38093820
3821+ if (ctx -> ignore_vcs ) {
3822+ cfprintf (cerr , " ${blu}-ignore_vcs${rs}" );
3823+ }
3824+
38103825 fputs ("\n" , stderr );
38113826
38123827 bfs_debug (ctx , flag , "(${red}-exclude${rs}\n" );
@@ -3838,6 +3853,7 @@ struct bfs_ctx *bfs_parse_cmdline(int argc, char *argv[]) {
38383853 }
38393854
38403855 ctx -> argc = argc ;
3856+ ctx -> ignore_vcs = false;
38413857 ctx -> argv = xmemdup (argv , sizeof_array (char * , argc + 1 ));
38423858 if (!ctx -> argv ) {
38433859 perror ("xmemdup()" );
0 commit comments