@@ -426,9 +426,12 @@ fn handle_ai_blame(args: &[String]) {
426426 std:: process:: exit ( 1 ) ;
427427 }
428428
429- // TODO: Do we have any 'global' args for the ai-blame?
430- // Find the git repository
431- let repo = match find_repository ( & Vec :: < String > :: new ( ) ) {
429+ // Find the git repository from current directory
430+ let current_dir = env:: current_dir ( )
431+ . unwrap_or_else ( |_| std:: path:: PathBuf :: from ( "." ) )
432+ . to_string_lossy ( )
433+ . to_string ( ) ;
434+ let repo = match find_repository_in_path ( & current_dir) {
432435 Ok ( repo) => repo,
433436 Err ( e) => {
434437 eprintln ! ( "Failed to find repository: {}" , e) ;
@@ -462,7 +465,11 @@ fn handle_ai_blame(args: &[String]) {
462465}
463466
464467fn handle_ai_diff ( args : & [ String ] ) {
465- let repo = match find_repository ( & Vec :: < String > :: new ( ) ) {
468+ let current_dir = env:: current_dir ( )
469+ . unwrap_or_else ( |_| std:: path:: PathBuf :: from ( "." ) )
470+ . to_string_lossy ( )
471+ . to_string ( ) ;
472+ let repo = match find_repository_in_path ( & current_dir) {
466473 Ok ( repo) => repo,
467474 Err ( e) => {
468475 eprintln ! ( "Failed to find repository: {}" , e) ;
@@ -510,7 +517,9 @@ fn handle_stats(args: &[String]) {
510517 break ;
511518 }
512519 // Stop if this looks like a commit SHA or range (contains ..)
513- if arg. contains ( ".." ) || ( commit_sha. is_none ( ) && !found_pattern && arg. len ( ) >= 7 ) {
520+ if arg. contains ( ".." )
521+ || ( commit_sha. is_none ( ) && !found_pattern && arg. len ( ) >= 7 )
522+ {
514523 // Could be a commit SHA, stop collecting patterns
515524 break ;
516525 }
0 commit comments