@@ -39,58 +39,52 @@ fn main() {
39
39
let start_path = Path :: new ( & args. path ) ;
40
40
// If user not specify exclude dirs, set it to empty
41
41
let exclude_dirs = args. exclude . as_deref ( ) . unwrap_or ( & [ ] ) ;
42
- let git_repos = find_git_repos ( start_path, exclude_dirs) ;
42
+ let git_repos = find_git_repos ( start_path, & exclude_dirs, args . workers as usize ) ;
43
43
44
- // Create a thread pool with a limited number of threads
45
- let num_threads: usize = args. workers as usize ;
46
- let pool = ThreadPool :: new ( num_threads) ;
47
-
48
- // Create a channel to send the results back to the main thread
49
- let ( tx, rx) = mpsc:: channel ( ) ;
50
-
51
- // Spawn a thread for each repo to check for untracked files
52
- for repo_path in git_repos {
53
- let tx = tx. clone ( ) ;
54
- let repo_path = repo_path. clone ( ) ;
55
- pool. execute ( move || {
56
- match check_untracked_files ( & repo_path) {
57
- Ok ( untracked_files) => {
58
- if !untracked_files. is_empty ( ) {
59
- // Send the results back to the main thread
60
- tx. send ( ( repo_path. clone ( ) , untracked_files) ) . unwrap ( ) ;
61
- }
62
- }
63
- Err ( e) => eprintln ! ( "{}: {}" , "Error checking repository" . red( ) , e) ,
64
- }
65
- } ) ;
66
- }
67
-
68
- // Close the sending side of the channel
69
- drop ( tx) ;
70
-
71
- // Print the results as they arrive
72
- let mut has_results = false ;
73
- while let Ok ( ( repo_path, untracked_files) ) = rx. recv ( ) {
74
- has_results = true ;
75
- println_orange ! ( "Untracked files in: {}" , repo_path. display( ) ) ;
76
- if !args. summary {
77
- for file in untracked_files {
78
- println_light_orange ! ( " - {}" , file) ;
79
- if args. diff {
80
- match show_diff ( & repo_path, & file) {
81
- Ok ( diff) => println ! ( "{}" , diff) ,
82
- Err ( e) => eprintln ! ( "{}: {}" , "Error showing diff" . red( ) , e) ,
83
- }
84
- }
85
- }
86
- }
87
- }
88
-
89
- // Print a message if no results were found
90
- if !has_results {
91
- println_orange ! (
92
- "-----> There are no changes to git in {}" ,
93
- start_path. display( )
94
- ) ;
95
- }
44
+ //
45
+ // // Spawn a thread for each repo to check for untracked files
46
+ // for repo_path in git_repos {
47
+ // let tx = tx.clone();
48
+ // let repo_path = repo_path.clone();
49
+ // pool.execute(move || {
50
+ // match check_untracked_files(&repo_path) {
51
+ // Ok(untracked_files) => {
52
+ // if !untracked_files.is_empty() {
53
+ // // Send the results back to the main thread
54
+ // tx.send((repo_path.clone(), untracked_files)).unwrap();
55
+ // }
56
+ // }
57
+ // Err(e) => eprintln!("{}: {}", "Error checking repository".red(), e),
58
+ // }
59
+ // });
60
+ // }
61
+ //
62
+ // // Close the sending side of the channel
63
+ // drop(tx);
64
+ //
65
+ // // Print the results as they arrive
66
+ // let mut has_results = false;
67
+ // while let Ok((repo_path, untracked_files)) = rx.recv() {
68
+ // has_results = true;
69
+ // println_orange!("Untracked files in: {}", repo_path.display());
70
+ // if !args.summary {
71
+ // for file in untracked_files {
72
+ // println_light_orange!(" - {}", file);
73
+ // if args.diff {
74
+ // match show_diff(&repo_path, &file) {
75
+ // Ok(diff) => println!("{}", diff),
76
+ // Err(e) => eprintln!("{}: {}", "Error showing diff".red(), e),
77
+ // }
78
+ // }
79
+ // }
80
+ // }
81
+ // }
82
+ //
83
+ // // Print a message if no results were found
84
+ // if !has_results {
85
+ // println_orange!(
86
+ // "-----> There are no changes to git in {}",
87
+ // start_path.display()
88
+ // );
89
+ // }
96
90
}
0 commit comments