@@ -383,11 +383,14 @@ static void output_pair_header(struct diff_options *diffopt,
383383 const char * color_new = diff_get_color_opt (diffopt , DIFF_FILE_NEW );
384384 const char * color_commit = diff_get_color_opt (diffopt , DIFF_COMMIT );
385385 const char * color ;
386+ char abbrev = diffopt -> abbrev ;
387+
388+ if (abbrev < 0 )
389+ abbrev = DEFAULT_ABBREV ;
386390
387391 if (!dashes -> len )
388392 strbuf_addchars (dashes , '-' ,
389- strlen (find_unique_abbrev (oid ,
390- DEFAULT_ABBREV )));
393+ strlen (find_unique_abbrev (oid , abbrev )));
391394
392395 if (!b_util ) {
393396 color = color_old ;
@@ -409,7 +412,7 @@ static void output_pair_header(struct diff_options *diffopt,
409412 strbuf_addf (buf , "%*s: %s " , patch_no_width , "-" , dashes -> buf );
410413 else
411414 strbuf_addf (buf , "%*d: %s " , patch_no_width , a_util -> i + 1 ,
412- find_unique_abbrev (& a_util -> oid , DEFAULT_ABBREV ));
415+ find_unique_abbrev (& a_util -> oid , abbrev ));
413416
414417 if (status == '!' )
415418 strbuf_addf (buf , "%s%s" , color_reset , color );
@@ -421,7 +424,7 @@ static void output_pair_header(struct diff_options *diffopt,
421424 strbuf_addf (buf , " %*s: %s" , patch_no_width , "-" , dashes -> buf );
422425 else
423426 strbuf_addf (buf , " %*d: %s" , patch_no_width , b_util -> i + 1 ,
424- find_unique_abbrev (& b_util -> oid , DEFAULT_ABBREV ));
427+ find_unique_abbrev (& b_util -> oid , abbrev ));
425428
426429 commit = lookup_commit_reference (the_repository , oid );
427430 if (commit ) {
0 commit comments