11use std:: collections:: BTreeMap ;
22
3+ use crate :: CLI_DATE ;
34use assignment:: FileAssignment ;
45use bstr:: { BString , ByteSlice } ;
56use but_core:: ui:: { TreeChange , TreeStatus } ;
@@ -8,10 +9,10 @@ use but_settings::AppSettings;
89use but_workspace:: ui:: StackDetails ;
910use colored:: { ColoredString , Colorize } ;
1011use gitbutler_command_context:: CommandContext ;
11- use gitbutler_commit:: commit_ext:: CommitExt ;
1212use gitbutler_oxidize:: { ObjectIdExt , OidExt , TimeExt } ;
1313use gitbutler_project:: Project ;
1414use serde:: Serialize ;
15+
1516pub ( crate ) mod assignment;
1617
1718use crate :: id:: CliId ;
@@ -24,6 +25,7 @@ struct CommonMergeBase {
2425 target_name : String ,
2526 common_merge_base : String ,
2627 message : String ,
28+ commit_date : String ,
2729}
2830
2931#[ derive( Serialize ) ]
@@ -81,17 +83,20 @@ pub(crate) async fn worktree(
8183 let target_name = format ! ( "{}/{}" , target. branch. remote( ) , target. branch. branch( ) ) ;
8284 let repo = ctx. gix_repo ( ) ?;
8385 let base_commit = repo. find_commit ( target. sha . to_gix ( ) ) ?;
86+ let base_commit = base_commit. decode ( ) ?;
8487 let message = base_commit
85- . message_bstr ( )
88+ . message
8689 . to_string ( )
8790 . replace ( '\n' , " " )
8891 . chars ( )
8992 . take ( 50 )
9093 . collect :: < String > ( ) ;
94+ let formatted_date = base_commit. committer ( ) . time ( ) ?. format_or_unix ( CLI_DATE ) ;
9195 let common_merge_base_data = CommonMergeBase {
9296 target_name : target_name. clone ( ) ,
9397 common_merge_base : target. sha . to_string ( ) [ ..7 ] . to_string ( ) ,
9498 message : message. clone ( ) ,
99+ commit_date : formatted_date,
95100 } ;
96101
97102 if json {
@@ -131,9 +136,10 @@ pub(crate) async fn worktree(
131136 }
132137 let dot = "●" . purple ( ) ;
133138 println ! (
134- "{dot} {} (common base) [{}] {}" ,
139+ "{dot} {} (common base) [{}] {} {} " ,
135140 common_merge_base_data. common_merge_base. dimmed( ) ,
136141 common_merge_base_data. target_name. green( ) . bold( ) ,
142+ common_merge_base_data. commit_date. dimmed( ) ,
137143 common_merge_base_data. message
138144 ) ;
139145 Ok ( ( ) )
@@ -440,7 +446,7 @@ fn print_commit(
440446
441447 if verbose {
442448 // Verbose format: author and timestamp on first line, message on second line
443- let formatted_time = created_at. format_or_unix ( gix :: date :: time :: format :: ISO8601 ) ;
449+ let formatted_time = created_at. format_or_unix ( CLI_DATE ) ;
444450 println ! (
445451 "┊{dot} {}{} {} {} {} {} {} {}" ,
446452 & commit_id. to_string( ) [ ..2 ] . blue( ) . underline( ) ,
0 commit comments