File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -328,7 +328,10 @@ pub fn get_git_version() -> String {
328328 let version = std:: process:: Command :: new ( "git" ) . arg ( "--version" ) . output ( ) ;
329329
330330 match version {
331- Ok ( v) => String :: from_utf8_lossy ( & v. stdout ) . replace ( '\n' , "" ) ,
331+ // TODO: make those replaces controllable with config
332+ Ok ( v) => String :: from_utf8_lossy ( & v. stdout )
333+ . replace ( '\n' , "" )
334+ . replace ( "version " , "v" ) ,
332335 Err ( _) => String :: new ( ) ,
333336 }
334337}
Original file line number Diff line number Diff line change @@ -92,22 +92,22 @@ mod tests {
9292 fn test_title_format ( ) -> Result < ( ) > {
9393 let mut title = Title {
9494 git_username : "onefetch-committer-name" . to_string ( ) ,
95- git_version : "git version 2 .37.2" . to_string ( ) ,
95+ git_version : "git v2 .37.2" . to_string ( ) ,
9696 title_color : DynColors :: Ansi ( AnsiColors :: Red ) ,
9797 tilde_color : DynColors :: Ansi ( AnsiColors :: White ) ,
9898 underline_color : DynColors :: Ansi ( AnsiColors :: Blue ) ,
9999 is_bold : true ,
100100 } ;
101101
102- title. git_version = "git version 2 .37.2" . to_string ( ) ;
102+ title. git_version = "git v2 .37.2" . to_string ( ) ;
103103 assert ! ( title. to_string( ) . contains( "onefetch-committer-name" ) ) ;
104104 assert ! ( title. to_string( ) . contains( '~' ) ) ;
105- assert ! ( title. to_string( ) . contains( "git version 2 .37.2" ) ) ;
105+ assert ! ( title. to_string( ) . contains( "git v2 .37.2" ) ) ;
106106
107107 title. git_version = String :: new ( ) ;
108108 assert ! ( title. to_string( ) . contains( "onefetch-committer-name" ) ) ;
109109 assert ! ( !title. to_string( ) . contains( '~' ) ) ;
110- assert ! ( !title. to_string( ) . contains( "git version 2 .37.2" ) ) ;
110+ assert ! ( !title. to_string( ) . contains( "git v2 .37.2" ) ) ;
111111
112112 title. git_username = String :: new ( ) ;
113113 let expected_title = String :: new ( ) ;
You can’t perform that action at this time.
0 commit comments