@@ -208,14 +208,13 @@ void log_write_email_headers(struct rev_info *opt, const char *name,
208208 * extra_headers_p = extra_headers ;
209209}
210210
211- void show_log (struct rev_info * opt , const char * sep )
211+ void show_log (struct rev_info * opt )
212212{
213213 struct strbuf msgbuf ;
214214 struct log_info * log = opt -> loginfo ;
215215 struct commit * commit = log -> commit , * parent = log -> parent ;
216216 int abbrev = opt -> diffopt .abbrev ;
217217 int abbrev_commit = opt -> abbrev_commit ? opt -> abbrev : 40 ;
218- const char * extra ;
219218 const char * subject = NULL , * extra_headers = opt -> extra_headers ;
220219 int need_8bit_cte = 0 ;
221220
@@ -240,17 +239,10 @@ void show_log(struct rev_info *opt, const char *sep)
240239 }
241240
242241 /*
243- * The "oneline" format has several special cases:
244- * - The pretty-printed commit lacks a newline at the end
245- * of the buffer, but we do want to make sure that we
246- * have a newline there. If the separator isn't already
247- * a newline, add an extra one.
248- * - unlike other log messages, the one-line format does
249- * not have an empty line between entries.
242+ * If use_terminator is set, add a newline at the end of the entry.
243+ * Otherwise, add a diffopt.line_termination character before all
244+ * entries but the first. (IOW, as a separator between entries)
250245 */
251- extra = "" ;
252- if (* sep != '\n' && opt -> use_terminator )
253- extra = "\n" ;
254246 if (opt -> shown_one && !opt -> use_terminator )
255247 putchar (opt -> diffopt .line_termination );
256248 opt -> shown_one = 1 ;
@@ -292,10 +284,8 @@ void show_log(struct rev_info *opt, const char *sep)
292284 show_reflog_message (opt -> reflog_info ,
293285 opt -> commit_format == CMIT_FMT_ONELINE ,
294286 opt -> date_mode );
295- if (opt -> commit_format == CMIT_FMT_ONELINE ) {
296- printf ("%s" , sep );
287+ if (opt -> commit_format == CMIT_FMT_ONELINE )
297288 return ;
298- }
299289 }
300290 }
301291
@@ -319,7 +309,8 @@ void show_log(struct rev_info *opt, const char *sep)
319309
320310 if (msgbuf .len ) {
321311 fwrite (msgbuf .buf , sizeof (char ), msgbuf .len , stdout );
322- printf ("%s%s" , extra , sep );
312+ if (opt -> use_terminator )
313+ putchar ('\n' );
323314 }
324315 strbuf_release (& msgbuf );
325316}
@@ -342,7 +333,7 @@ int log_tree_diff_flush(struct rev_info *opt)
342333 * an extra newline between the end of log and the
343334 * output for readability.
344335 */
345- show_log (opt , opt -> diffopt . msg_sep );
336+ show_log (opt );
346337 if ((opt -> diffopt .output_format & ~DIFF_FORMAT_NO_OUTPUT ) &&
347338 opt -> verbose_header &&
348339 opt -> commit_format != CMIT_FMT_ONELINE ) {
@@ -430,7 +421,7 @@ int log_tree_commit(struct rev_info *opt, struct commit *commit)
430421 shown = log_tree_diff (opt , commit , & log );
431422 if (!shown && opt -> loginfo && opt -> always_show_header ) {
432423 log .parent = NULL ;
433- show_log (opt , "" );
424+ show_log (opt );
434425 shown = 1 ;
435426 }
436427 opt -> loginfo = NULL ;
0 commit comments