File tree 2 files changed +8
-5
lines changed 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 {
328
328
let version = std:: process:: Command :: new ( "git" ) . arg ( "--version" ) . output ( ) ;
329
329
330
330
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" ) ,
332
335
Err ( _) => String :: new ( ) ,
333
336
}
334
337
}
Original file line number Diff line number Diff line change @@ -92,22 +92,22 @@ mod tests {
92
92
fn test_title_format ( ) -> Result < ( ) > {
93
93
let mut title = Title {
94
94
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 ( ) ,
96
96
title_color : DynColors :: Ansi ( AnsiColors :: Red ) ,
97
97
tilde_color : DynColors :: Ansi ( AnsiColors :: White ) ,
98
98
underline_color : DynColors :: Ansi ( AnsiColors :: Blue ) ,
99
99
is_bold : true ,
100
100
} ;
101
101
102
- title. git_version = "git version 2 .37.2" . to_string ( ) ;
102
+ title. git_version = "git v2 .37.2" . to_string ( ) ;
103
103
assert ! ( title. to_string( ) . contains( "onefetch-committer-name" ) ) ;
104
104
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" ) ) ;
106
106
107
107
title. git_version = String :: new ( ) ;
108
108
assert ! ( title. to_string( ) . contains( "onefetch-committer-name" ) ) ;
109
109
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" ) ) ;
111
111
112
112
title. git_username = String :: new ( ) ;
113
113
let expected_title = String :: new ( ) ;
You can’t perform that action at this time.
0 commit comments