@@ -310,7 +310,7 @@ static int mailmap_name(struct strbuf *sb, const char *email)
310310}
311311
312312static size_t format_person_part (struct strbuf * sb , char part ,
313- const char * msg , int len )
313+ const char * msg , int len , enum date_mode dmode )
314314{
315315 /* currently all placeholders have same length */
316316 const int placeholder_len = 2 ;
@@ -377,7 +377,7 @@ static size_t format_person_part(struct strbuf *sb, char part,
377377
378378 switch (part ) {
379379 case 'd' : /* date */
380- strbuf_addstr (sb , show_date (date , tz , DATE_NORMAL ));
380+ strbuf_addstr (sb , show_date (date , tz , dmode ));
381381 return placeholder_len ;
382382 case 'D' : /* date, RFC2822 style */
383383 strbuf_addstr (sb , show_date (date , tz , DATE_RFC2822 ));
@@ -409,6 +409,7 @@ struct chunk {
409409
410410struct format_commit_context {
411411 const struct commit * commit ;
412+ enum date_mode dmode ;
412413
413414 /* These offsets are relative to the start of the commit message. */
414415 int commit_header_parsed ;
@@ -584,10 +585,12 @@ static size_t format_commit_item(struct strbuf *sb, const char *placeholder,
584585 return 1 ;
585586 case 'a' : /* author ... */
586587 return format_person_part (sb , placeholder [1 ],
587- msg + c -> author .off , c -> author .len );
588+ msg + c -> author .off , c -> author .len ,
589+ c -> dmode );
588590 case 'c' : /* committer ... */
589591 return format_person_part (sb , placeholder [1 ],
590- msg + c -> committer .off , c -> committer .len );
592+ msg + c -> committer .off , c -> committer .len ,
593+ c -> dmode );
591594 case 'e' : /* encoding */
592595 strbuf_add (sb , msg + c -> encoding .off , c -> encoding .len );
593596 return 1 ;
@@ -599,12 +602,14 @@ static size_t format_commit_item(struct strbuf *sb, const char *placeholder,
599602}
600603
601604void format_commit_message (const struct commit * commit ,
602- const void * format , struct strbuf * sb )
605+ const void * format , struct strbuf * sb ,
606+ enum date_mode dmode )
603607{
604608 struct format_commit_context context ;
605609
606610 memset (& context , 0 , sizeof (context ));
607611 context .commit = commit ;
612+ context .dmode = dmode ;
608613 strbuf_expand (sb , format , format_commit_item , & context );
609614}
610615
@@ -770,7 +775,7 @@ void pretty_print_commit(enum cmit_fmt fmt, const struct commit *commit,
770775 const char * encoding ;
771776
772777 if (fmt == CMIT_FMT_USERFORMAT ) {
773- format_commit_message (commit , user_format , sb );
778+ format_commit_message (commit , user_format , sb , dmode );
774779 return ;
775780 }
776781
0 commit comments