@@ -567,7 +567,7 @@ char *logmsg_reencode(const struct commit *commit,
567567 char * encoding ;
568568 char * out ;
569569
570- if (!* output_encoding )
570+ if (!output_encoding || ! * output_encoding )
571571 return NULL ;
572572 encoding = get_header (commit , "encoding" );
573573 use_encoding = encoding ? encoding : utf8 ;
@@ -1250,23 +1250,15 @@ void format_commit_message(const struct commit *commit,
12501250 const struct pretty_print_context * pretty_ctx )
12511251{
12521252 struct format_commit_context context ;
1253- static const char utf8 [] = "UTF-8" ;
12541253 const char * output_enc = pretty_ctx -> output_encoding ;
12551254
12561255 memset (& context , 0 , sizeof (context ));
12571256 context .commit = commit ;
12581257 context .pretty_ctx = pretty_ctx ;
12591258 context .wrap_start = sb -> len ;
1260- context .message = commit -> buffer ;
1261- if (output_enc ) {
1262- char * enc = get_header (commit , "encoding" );
1263- if (strcmp (enc ? enc : utf8 , output_enc )) {
1264- context .message = logmsg_reencode (commit , output_enc );
1265- if (!context .message )
1266- context .message = commit -> buffer ;
1267- }
1268- free (enc );
1269- }
1259+ context .message = logmsg_reencode (commit , output_enc );
1260+ if (!context .message )
1261+ context .message = commit -> buffer ;
12701262
12711263 strbuf_expand (sb , format , format_commit_item , & context );
12721264 rewrap_message_tail (sb , & context , 0 , 0 , 0 );
0 commit comments