@@ -64,12 +64,13 @@ static int diff_root_tree(const unsigned char *new, const char *base)
6464
6565static const char * generate_header (const unsigned char * commit_sha1 ,
6666 const unsigned char * parent_sha1 ,
67- const char * msg )
67+ const struct commit * commit )
6868{
6969 static char this_header [16384 ];
7070 int offset ;
7171 unsigned long len ;
7272 int abbrev = diff_options .abbrev ;
73+ const char * msg = commit -> buffer ;
7374
7475 if (!verbose_header )
7576 return sha1_to_hex (commit_sha1 );
@@ -82,7 +83,7 @@ static const char *generate_header(const unsigned char *commit_sha1,
8283 offset += sprintf (this_header + offset , "(from %s)\n" ,
8384 parent_sha1 ?
8485 diff_unique_abbrev (parent_sha1 , abbrev ) : "root" );
85- offset += pretty_print_commit (commit_format , msg , len ,
86+ offset += pretty_print_commit (commit_format , commit , len ,
8687 this_header + offset ,
8788 sizeof (this_header ) - offset , abbrev );
8889 return this_header ;
@@ -103,7 +104,7 @@ static int diff_tree_commit(const unsigned char *commit_sha1)
103104
104105 /* Root commit? */
105106 if (show_root_diff && !commit -> parents ) {
106- header = generate_header (sha1 , NULL , commit -> buffer );
107+ header = generate_header (sha1 , NULL , commit );
107108 diff_root_tree (commit_sha1 , "" );
108109 }
109110
@@ -113,9 +114,7 @@ static int diff_tree_commit(const unsigned char *commit_sha1)
113114
114115 for (parents = commit -> parents ; parents ; parents = parents -> next ) {
115116 struct commit * parent = parents -> item ;
116- header = generate_header (sha1 ,
117- parent -> object .sha1 ,
118- commit -> buffer );
117+ header = generate_header (sha1 , parent -> object .sha1 , commit );
119118 diff_tree_sha1_top (parent -> object .sha1 , commit_sha1 , "" );
120119 if (!header && verbose_header ) {
121120 header_prefix = "\ndiff-tree " ;
0 commit comments