Add msg_sep to diff_options
Add msg_sep variable to struct diff_options. msg_sep is printed after commit message. Default is "\n", format-patch sets it to "---\n". This also removes the second argument from show_log() because all callers derived it from the first argument: show_log(rev, rev->loginfo, ... Signed-off-by: Timo Hirvonen <tihirvon@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
Timo Hirvonen committed
Jun 25, 2006 at 13:54 UTC
39bc9a6c2051a9fc31dc9b34b40bdd3dd94a8afb
6 files changed
+14
-13
builtin-log.c
+1
@@ -175,6 +175,7 @@ int cmd_format_patch(int argc, const char **argv, char **envp)
175
rev.diff = 1;
176
rev.combine_merges = 0;
177
rev.ignore_merges = 1;
178
+ rev.diffopt.msg_sep = "---\n";
179
180
git_config(git_format_config);
181
rev.extra_headers = extra_headers;
combine-diff.c
+4
-3
@@ -701,7 +701,7 @@ static int show_patch_diff(struct combine_diff_path *elem, int num_parent,
701
const char *abb;
702
703
if (rev->loginfo)
704
- show_log(rev, rev->loginfo, "\n");
704
+ show_log(rev, opt->msg_sep);
705
dump_quoted_path(dense ? "diff --cc " : "diff --combined ", elem->path);
706
printf("index ");
707
for (i = 0; i < num_parent; i++) {
@@ -769,7 +769,7 @@ static void show_raw_diff(struct combine_diff_path *p, int num_parent, struct re
769
inter_name_termination = 0;
770
771
if (rev->loginfo)
772
- show_log(rev, rev->loginfo, "\n");
772
+ show_log(rev, opt->msg_sep);
773
774
if (opt->output_format & DIFF_FORMAT_RAW) {
775
offset = strlen(COLONS) - num_parent;
@@ -855,7 +855,8 @@ void diff_tree_combined(const unsigned char *sha1,
855
paths = intersect_paths(paths, i, num_parent);
856
857
if (opt->output_format & DIFF_FORMAT_DIFFSTAT && rev->loginfo)
858
- show_log(rev, rev->loginfo, "---\n");
858
+ show_log(rev, opt->msg_sep);
859
+
860
diff_flush(&diffopts);
861
if (opt->output_format & DIFF_FORMAT_DIFFSTAT)
862
putchar('\n');
diff.c
+1
@@ -1424,6 +1424,7 @@ void diff_setup(struct diff_options *options)
1424
options->break_opt = -1;
1425
options->rename_limit = -1;
1426
options->context = 3;
1427
+ options->msg_sep = "\n";
1428
1429
options->change = diff_change;
1430
options->add_remove = diff_addremove;
diff.h
+1
@@ -57,6 +57,7 @@ struct diff_options {
57
int rename_limit;
58
int setup;
59
int abbrev;
60
+ const char *msg_sep;
61
const char *stat_sep;
62
long xdl_opts;
63
log-tree.c
+6
-9
@@ -43,9 +43,10 @@ static int append_signoff(char *buf, int buf_sz, int at, const char *signoff)
43
return at;
44
}
45
46
-void show_log(struct rev_info *opt, struct log_info *log, const char *sep)
46
+void show_log(struct rev_info *opt, const char *sep)
47
{
48
static char this_header[16384];
49
+ struct log_info *log = opt->loginfo;
50
struct commit *commit = log->commit, *parent = log->parent;
51
int abbrev = opt->diffopt.abbrev;
52
int abbrev_commit = opt->abbrev_commit ? opt->abbrev : 40;
@@ -163,13 +164,9 @@ int log_tree_diff_flush(struct rev_info *opt)
164
return 0;
165
}
166
166
- if (opt->loginfo && !opt->no_commit_id) {
167
- if (opt->diffopt.output_format & DIFF_FORMAT_DIFFSTAT) {
168
- show_log(opt, opt->loginfo, "---\n");
169
- } else {
170
- show_log(opt, opt->loginfo, "\n");
171
- }
172
- }
167
+ if (opt->loginfo && !opt->no_commit_id)
168
+ show_log(opt, opt->diffopt.msg_sep);
169
+
170
diff_flush(&opt->diffopt);
171
return 1;
172
}
@@ -266,7 +263,7 @@ int log_tree_commit(struct rev_info *opt, struct commit *commit)
263
shown = log_tree_diff(opt, commit, &log);
264
if (!shown && opt->loginfo && opt->always_show_header) {
265
log.parent = NULL;
269
- show_log(opt, opt->loginfo, "");
266
+ show_log(opt, "");
267
shown = 1;
268
}
269
opt->loginfo = NULL;
log-tree.h
+1
-1
@@ -11,6 +11,6 @@ void init_log_tree_opt(struct rev_info *);
11
int log_tree_diff_flush(struct rev_info *);
12
int log_tree_commit(struct rev_info *, struct commit *);
13
int log_tree_opt_parse(struct rev_info *, const char **, int);
14
-void show_log(struct rev_info *opt, struct log_info *log, const char *sep);
14
+void show_log(struct rev_info *opt, const char *sep);
15
16
#endif