@@ -314,7 +314,6 @@ impl Info {
314
314
version,
315
315
pending,
316
316
repo_size,
317
- last_change,
318
317
project_license,
319
318
dominant_language,
320
319
) = futures:: join!(
@@ -325,14 +324,14 @@ impl Info {
325
324
Info :: get_version( workdir_str) ,
326
325
Info :: get_pending_changes( workdir_str) ,
327
326
Info :: get_packed_size( workdir_str) ,
328
- Info :: get_last_change( workdir_str) ,
329
327
Info :: get_project_license( workdir_str) ,
330
328
Language :: get_dominant_language( & languages_stats)
331
329
) ;
332
330
333
331
let creation_date = Info :: get_creation_date ( & git_history) ;
334
332
let number_of_commits = Info :: get_number_of_commits ( & git_history) ;
335
333
let authors = Info :: get_authors ( & git_history, author_nb) ;
334
+ let last_change = Info :: get_date_of_last_commit ( & git_history) ;
336
335
337
336
let conf = config?;
338
337
Ok ( Info {
@@ -614,24 +613,15 @@ impl Info {
614
613
}
615
614
}
616
615
617
- async fn get_last_change ( dir : & str ) -> Result < String > {
618
- let output = Command :: new ( "git" )
619
- . arg ( "-C" )
620
- . arg ( dir)
621
- . arg ( "log" )
622
- . arg ( "-1" )
623
- . arg ( "--format=%cr" )
624
- . output ( )
625
- . await
626
- . expect ( "Failed to execute git." ) ;
616
+ fn get_date_of_last_commit ( git_history : & [ String ] ) -> Result < String > {
617
+ let last_commit = git_history. first ( ) ;
627
618
628
- let output = String :: from_utf8_lossy ( & output. stdout ) ;
619
+ let output = match last_commit {
620
+ Some ( date) => date. split ( '\u{09}' ) . collect :: < Vec < _ > > ( ) [ 0 ] . to_string ( ) ,
621
+ None => "??" . into ( ) ,
622
+ } ;
629
623
630
- if output == "" {
631
- Ok ( "??" . into ( ) )
632
- } else {
633
- Ok ( output. to_string ( ) . replace ( '\n' , "" ) )
634
- }
624
+ Ok ( output)
635
625
}
636
626
637
627
fn get_creation_date ( git_history : & [ String ] ) -> Result < String > {
0 commit comments