@@ -139,8 +139,12 @@ static void read_from_stdin(struct shortlog *log)
139139void shortlog_add_commit (struct shortlog * log , struct commit * commit )
140140{
141141 const char * author = NULL , * buffer ;
142+ struct strbuf buf = STRBUF_INIT ;
143+ struct strbuf ufbuf = STRBUF_INIT ;
142144
143- buffer = commit -> buffer ;
145+ pretty_print_commit (CMIT_FMT_RAW , commit , & buf ,
146+ 0 , NULL , NULL , DATE_NORMAL , 0 );
147+ buffer = buf .buf ;
144148 while (* buffer && * buffer != '\n' ) {
145149 const char * eol = strchr (buffer , '\n' );
146150
@@ -157,17 +161,15 @@ void shortlog_add_commit(struct shortlog *log, struct commit *commit)
157161 die ("Missing author: %s" ,
158162 sha1_to_hex (commit -> object .sha1 ));
159163 if (log -> user_format ) {
160- struct strbuf buf = STRBUF_INIT ;
161-
162- pretty_print_commit (CMIT_FMT_USERFORMAT , commit , & buf ,
164+ pretty_print_commit (CMIT_FMT_USERFORMAT , commit , & ufbuf ,
163165 DEFAULT_ABBREV , "" , "" , DATE_NORMAL , 0 );
164- insert_one_record (log , author , buf .buf );
165- strbuf_release (& buf );
166- return ;
167- }
168- if (* buffer )
166+ buffer = ufbuf .buf ;
167+ } else if (* buffer ) {
169168 buffer ++ ;
169+ }
170170 insert_one_record (log , author , !* buffer ? "<none>" : buffer );
171+ strbuf_release (& ufbuf );
172+ strbuf_release (& buf );
171173}
172174
173175static void get_from_rev (struct rev_info * rev , struct shortlog * log )
0 commit comments