@@ -25,46 +25,34 @@ pub fn append_trailers(commit_msg_file: &PathBuf, agent: &Agent, debug: bool) ->
2525 let addr = Agent :: extract_email_addr ( agent. email ) ;
2626 let content_lower = content. to_lowercase ( ) ;
2727 let has_co_author = content_lower. contains ( "co-authored-by:" ) && content_lower. contains ( & addr. to_lowercase ( ) ) ;
28- let has_ai_assisted = content_lower. contains ( "ai-assisted: true" ) ;
2928
30- if has_co_author && has_ai_assisted {
29+ if has_co_author {
3130 if debug {
3231 eprintln ! ( "\n === Git Command ===" ) ;
33- eprintln ! ( "Trailers already present, skipping git interpret-trailers" ) ;
32+ eprintln ! ( "Co-authored-by trailer already present, skipping git interpret-trailers" ) ;
3433 }
3534 return Ok ( ( ) ) ;
3635 }
3736
38- let mut cmd = std:: process:: Command :: new ( "git" ) ;
39- cmd. arg ( "interpret-trailers" ) . arg ( "--in-place" ) ;
37+ let co_authored = format ! ( "Co-authored-by: {}" , agent. email) ;
4038
41- if !has_co_author {
42- let co_authored = format ! ( "Co-authored-by: {}" , agent. email) ;
43- if debug {
44- eprintln ! ( "\n === Git Command ===" ) ;
45- eprintln ! (
46- "git interpret-trailers --in-place --trailer \" {}\" --if-exists addIfDifferent --trailer \" Ai-assisted: true\" \" {}\" " ,
47- co_authored,
48- commit_msg_file. display( )
49- ) ;
50- }
51- cmd. arg ( "--trailer" )
52- . arg ( & co_authored)
53- . arg ( "--if-exists" )
54- . arg ( "addIfDifferent" ) ;
55- } else if debug {
39+ if debug {
5640 eprintln ! ( "\n === Git Command ===" ) ;
5741 eprintln ! (
58- "git interpret-trailers --in-place --trailer \" Ai-assisted: true\" \" {}\" " ,
42+ "git interpret-trailers --in-place --trailer \" {}\" --if-exists addIfDifferent \" {}\" " ,
43+ co_authored,
5944 commit_msg_file. display( )
6045 ) ;
6146 }
6247
63- if !has_ai_assisted {
64- cmd. arg ( "--trailer" ) . arg ( "Ai-assisted: true" ) ;
65- }
66-
67- cmd. arg ( commit_msg_file) ;
48+ let mut cmd = std:: process:: Command :: new ( "git" ) ;
49+ cmd. arg ( "interpret-trailers" )
50+ . arg ( "--in-place" )
51+ . arg ( "--trailer" )
52+ . arg ( & co_authored)
53+ . arg ( "--if-exists" )
54+ . arg ( "addIfDifferent" )
55+ . arg ( commit_msg_file) ;
6856
6957 let output = cmd. output ( ) ?;
7058
0 commit comments