File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -97,12 +97,26 @@ pub fn get_untracked_and_modified_files(repo_path: &str) -> Result<Vec<String>,
9797 let mut changed_files = Vec :: new ( ) ;
9898
9999 let statuses = repo. statuses ( None ) ?;
100+
101+ let globs_to_ignore = [
102+ "**/.vs/**" ,
103+ "**/.vscode/**" ,
104+ "**/.idea/**" ,
105+ ] ;
106+ let mut glob_builder = GlobSetBuilder :: new ( ) ;
107+ for & pattern in & globs_to_ignore {
108+ glob_builder. add ( Glob :: new ( pattern) . unwrap ( ) ) ;
109+ }
110+ let glob_set = glob_builder. build ( ) . unwrap ( ) ;
100111
101112 for entry in statuses. iter ( ) {
102113 let status = entry. status ( ) ;
103114 let file_path = entry. path ( ) . unwrap_or ( "" ) . to_string ( ) ;
104115
105- if status. contains ( git2:: Status :: WT_NEW ) || status. contains ( git2:: Status :: WT_MODIFIED ) || status. contains ( git2:: Status :: WT_DELETED ) {
116+ let ignore_file = glob_set. is_match ( & file_path) ;
117+ if ( status. contains ( git2:: Status :: WT_NEW ) && !status. contains ( git2:: Status :: IGNORED ) && !ignore_file)
118+ || status. contains ( git2:: Status :: WT_MODIFIED )
119+ || status. contains ( git2:: Status :: WT_DELETED ) {
106120 changed_files. push ( file_path) ;
107121 }
108122 }
You can’t perform that action at this time.
0 commit comments