Skip to content

Commit 0286565

Browse files
simpkinsgitster
authored andcommitted
Remove dead code: show_log() sep argument and diff_options.msg_sep
These variables were made unnecessary by commit 3969cf7. Signed-off-by: Adam Simpkins <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent abfa533 commit 0286565

File tree

6 files changed

+13
-25
lines changed

6 files changed

+13
-25
lines changed

builtin-log.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,6 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
770770
rev.diff = 1;
771771
rev.combine_merges = 0;
772772
rev.ignore_merges = 1;
773-
rev.diffopt.msg_sep = "";
774773
DIFF_OPT_SET(&rev.diffopt, RECURSIVE);
775774

776775
rev.subject_prefix = fmt_patch_subject_prefix;

combine-diff.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
798798
int deleted = 0;
799799

800800
if (rev->loginfo && !rev->no_commit_id)
801-
show_log(rev, opt->msg_sep);
801+
show_log(rev);
802802
dump_quoted_path(dense ? "diff --cc " : "diff --combined ",
803803
"", elem->path, c_meta, c_reset);
804804
printf("%sindex ", c_meta);
@@ -881,7 +881,7 @@ static void show_raw_diff(struct combine_diff_path *p, int num_parent, struct re
881881
inter_name_termination = 0;
882882

883883
if (rev->loginfo && !rev->no_commit_id)
884-
show_log(rev, opt->msg_sep);
884+
show_log(rev);
885885

886886
if (opt->output_format & DIFF_FORMAT_RAW) {
887887
offset = strlen(COLONS) - num_parent;
@@ -962,7 +962,7 @@ void diff_tree_combined(const unsigned char *sha1,
962962
paths = intersect_paths(paths, i, num_parent);
963963

964964
if (show_log_first && i == 0) {
965-
show_log(rev, opt->msg_sep);
965+
show_log(rev);
966966
if (rev->verbose_header && opt->output_format)
967967
putchar(opt->line_termination);
968968
}

diff.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2220,7 +2220,6 @@ void diff_setup(struct diff_options *options)
22202220
options->rename_limit = -1;
22212221
options->dirstat_percent = 3;
22222222
options->context = 3;
2223-
options->msg_sep = "";
22242223

22252224
options->change = diff_change;
22262225
options->add_remove = diff_addremove;

diff.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ struct diff_options {
8888
int abbrev;
8989
const char *prefix;
9090
int prefix_length;
91-
const char *msg_sep;
9291
const char *stat_sep;
9392
long xdl_opts;
9493

log-tree.c

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -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;

log-tree.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ void init_log_tree_opt(struct rev_info *);
1111
int log_tree_diff_flush(struct rev_info *);
1212
int log_tree_commit(struct rev_info *, struct commit *);
1313
int log_tree_opt_parse(struct rev_info *, const char **, int);
14-
void show_log(struct rev_info *opt, const char *sep);
14+
void show_log(struct rev_info *opt);
1515
void show_decorations(struct commit *commit);
1616
void log_write_email_headers(struct rev_info *opt, const char *name,
1717
const char **subject_p,

0 commit comments

Comments
 (0)