@@ -567,7 +567,7 @@ char *logmsg_reencode(const struct commit *commit,
567
567
char * encoding ;
568
568
char * out ;
569
569
570
- if (!* output_encoding )
570
+ if (!output_encoding || ! * output_encoding )
571
571
return NULL ;
572
572
encoding = get_header (commit , "encoding" );
573
573
use_encoding = encoding ? encoding : utf8 ;
@@ -1250,23 +1250,15 @@ void format_commit_message(const struct commit *commit,
1250
1250
const struct pretty_print_context * pretty_ctx )
1251
1251
{
1252
1252
struct format_commit_context context ;
1253
- static const char utf8 [] = "UTF-8" ;
1254
1253
const char * output_enc = pretty_ctx -> output_encoding ;
1255
1254
1256
1255
memset (& context , 0 , sizeof (context ));
1257
1256
context .commit = commit ;
1258
1257
context .pretty_ctx = pretty_ctx ;
1259
1258
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 ;
1270
1262
1271
1263
strbuf_expand (sb , format , format_commit_item , & context );
1272
1264
rewrap_message_tail (sb , & context , 0 , 0 , 0 );
0 commit comments