@@ -1371,7 +1371,8 @@ static void get_commit_info(struct commit *commit,
1371
1371
int detailed )
1372
1372
{
1373
1373
int len ;
1374
- char * tmp , * endp , * reencoded , * message ;
1374
+ const char * subject ;
1375
+ char * reencoded , * message ;
1375
1376
static char author_name [1024 ];
1376
1377
static char author_mail [1024 ];
1377
1378
static char committer_name [1024 ];
@@ -1413,22 +1414,13 @@ static void get_commit_info(struct commit *commit,
1413
1414
& ret -> committer_time , & ret -> committer_tz );
1414
1415
1415
1416
ret -> summary = summary_buf ;
1416
- tmp = strstr (message , "\n\n" );
1417
- if (!tmp ) {
1418
- error_out :
1417
+ len = find_commit_subject (message , & subject );
1418
+ if (len && len < sizeof (summary_buf )) {
1419
+ memcpy (summary_buf , subject , len );
1420
+ summary_buf [len ] = 0 ;
1421
+ } else {
1419
1422
sprintf (summary_buf , "(%s)" , sha1_to_hex (commit -> object .sha1 ));
1420
- free (reencoded );
1421
- return ;
1422
1423
}
1423
- tmp += 2 ;
1424
- endp = strchr (tmp , '\n' );
1425
- if (!endp )
1426
- endp = tmp + strlen (tmp );
1427
- len = endp - tmp ;
1428
- if (len >= sizeof (summary_buf ) || len == 0 )
1429
- goto error_out ;
1430
- memcpy (summary_buf , tmp , len );
1431
- summary_buf [len ] = 0 ;
1432
1424
free (reencoded );
1433
1425
}
1434
1426
0 commit comments