@@ -608,16 +608,14 @@ pub async fn generate_commit_message_parallel(
608608
609609 // Phase 1: Analyze each file in parallel using simplified approach
610610 log:: debug!( "Starting parallel analysis of {} files" , parsed_files. len( ) ) ;
611-
611+
612612 let analysis_futures: Vec < _ > = parsed_files
613613 . iter ( )
614614 . map ( |file| {
615615 let file_path = file. path . clone ( ) ;
616616 let operation = file. operation . clone ( ) ;
617617 let diff_content = file. diff_content . clone ( ) ;
618- async move {
619- analyze_single_file_simple ( client, model, & file_path, & operation, & diff_content) . await
620- }
618+ async move { analyze_single_file_simple ( client, model, & file_path, & operation, & diff_content) . await }
621619 } )
622620 . collect ( ) ;
623621
@@ -650,24 +648,15 @@ pub async fn generate_commit_message_parallel(
650648
651649 // Phase 2: Synthesize final commit message from all analyses
652650 log:: debug!( "Synthesizing final commit message from {} analyses" , successful_analyses. len( ) ) ;
653-
654- let synthesis_result = synthesize_commit_message (
655- client,
656- model,
657- & successful_analyses,
658- max_length. unwrap_or ( 72 ) ,
659- ) . await ?;
651+
652+ let synthesis_result = synthesize_commit_message ( client, model, & successful_analyses, max_length. unwrap_or ( 72 ) ) . await ?;
660653
661654 Ok ( synthesis_result)
662655}
663656
664657/// Analyzes a single file using simplified text completion (no function calling)
665658async fn analyze_single_file_simple (
666- client : & Client < OpenAIConfig > ,
667- model : & str ,
668- file_path : & str ,
669- operation : & str ,
670- diff_content : & str ,
659+ client : & Client < OpenAIConfig > , model : & str , file_path : & str , operation : & str , diff_content : & str
671660) -> Result < String > {
672661 let system_prompt = "You are a git diff analyzer. Analyze the provided file change and provide a concise summary in 1-2 sentences describing what changed and why it matters." ;
673662
@@ -704,10 +693,7 @@ async fn analyze_single_file_simple(
704693
705694/// Synthesizes a final commit message from multiple file analyses
706695async fn synthesize_commit_message (
707- client : & Client < OpenAIConfig > ,
708- model : & str ,
709- analyses : & [ ( String , String ) ] ,
710- max_length : usize ,
696+ client : & Client < OpenAIConfig > , model : & str , analyses : & [ ( String , String ) ] , max_length : usize
711697) -> Result < String > {
712698 // Build context from all analyses
713699 let mut context = String :: new ( ) ;
@@ -1003,12 +989,12 @@ index abcd123..efgh456 100644
1003989 assert_eq ! ( files. len( ) , 2 ) ;
1004990 assert_eq ! ( files[ 0 ] . path, "src/auth.rs" ) ;
1005991 assert_eq ! ( files[ 1 ] . path, "src/main.rs" ) ;
1006-
992+
1007993 // Verify diff content is captured
1008994 assert ! ( files[ 0 ] . diff_content. contains( "use crate::security" ) ) ;
1009995 assert ! ( files[ 1 ] . diff_content. contains( "auth::authenticate" ) ) ;
1010996 }
1011-
997+
1012998 #[ test]
1013999 fn test_parse_diff_edge_cases ( ) {
10141000 // Test parsing with various git prefixes and edge cases
@@ -1025,13 +1011,13 @@ index 1234567..0000000
10251011 assert_eq ! ( files. len( ) , 1 ) ;
10261012 assert_eq ! ( files[ 0 ] . path, "old_file.txt" , "Should extract original path for deleted files" ) ;
10271013 assert_eq ! ( files[ 0 ] . operation, "deleted" ) ;
1028-
1014+
10291015 // Test with binary files
10301016 let diff_binary = r#"diff --git a/image.png b/image.png
10311017new file mode 100644
10321018index 0000000..1234567
10331019Binary files /dev/null and b/image.png differ"# ;
1034-
1020+
10351021 let files = parse_diff ( diff_binary) . unwrap ( ) ;
10361022 assert_eq ! ( files. len( ) , 1 ) ;
10371023 assert_eq ! ( files[ 0 ] . path, "image.png" ) ;
0 commit comments