Merge branch 'es/format-patch-range-diff-fix-fix'
* es/format-patch-range-diff-fix-fix: range-diff: always pass at least minimal diff options
This commit is contained in:
commit
965798d1f2
@ -1094,9 +1094,18 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout,
|
||||
}
|
||||
|
||||
if (rev->rdiff1) {
|
||||
/*
|
||||
* Pass minimum required diff-options to range-diff; others
|
||||
* can be added later if deemed desirable.
|
||||
*/
|
||||
struct diff_options opts;
|
||||
diff_setup(&opts);
|
||||
opts.file = rev->diffopt.file;
|
||||
opts.use_color = rev->diffopt.use_color;
|
||||
diff_setup_done(&opts);
|
||||
fprintf_ln(rev->diffopt.file, "%s", rev->rdiff_title);
|
||||
show_range_diff(rev->rdiff1, rev->rdiff2,
|
||||
rev->creation_factor, 1, NULL);
|
||||
rev->creation_factor, 1, &opts);
|
||||
}
|
||||
}
|
||||
|
||||
|
11
log-tree.c
11
log-tree.c
@ -755,14 +755,23 @@ void show_log(struct rev_info *opt)
|
||||
|
||||
if (cmit_fmt_is_mail(ctx.fmt) && opt->rdiff1) {
|
||||
struct diff_queue_struct dq;
|
||||
struct diff_options opts;
|
||||
|
||||
memcpy(&dq, &diff_queued_diff, sizeof(diff_queued_diff));
|
||||
DIFF_QUEUE_CLEAR(&diff_queued_diff);
|
||||
|
||||
next_commentary_block(opt, NULL);
|
||||
fprintf_ln(opt->diffopt.file, "%s", opt->rdiff_title);
|
||||
/*
|
||||
* Pass minimum required diff-options to range-diff; others
|
||||
* can be added later if deemed desirable.
|
||||
*/
|
||||
diff_setup(&opts);
|
||||
opts.file = opt->diffopt.file;
|
||||
opts.use_color = opt->diffopt.use_color;
|
||||
diff_setup_done(&opts);
|
||||
show_range_diff(opt->rdiff1, opt->rdiff2,
|
||||
opt->creation_factor, 1, NULL);
|
||||
opt->creation_factor, 1, &opts);
|
||||
|
||||
memcpy(&diff_queued_diff, &dq, sizeof(diff_queued_diff));
|
||||
}
|
||||
|
@ -248,18 +248,24 @@ test_expect_success 'dual-coloring' '
|
||||
for prev in topic master..topic
|
||||
do
|
||||
test_expect_success "format-patch --range-diff=$prev" '
|
||||
git format-patch --stdout --cover-letter --range-diff=$prev \
|
||||
git format-patch --cover-letter --range-diff=$prev \
|
||||
master..unmodified >actual &&
|
||||
grep "= 1: .* s/5/A" actual &&
|
||||
grep "= 2: .* s/4/A" actual &&
|
||||
grep "= 3: .* s/11/B" actual &&
|
||||
grep "= 4: .* s/12/B" actual
|
||||
test_when_finished "rm 000?-*" &&
|
||||
test_line_count = 5 actual &&
|
||||
test_i18ngrep "^Range-diff:$" 0000-* &&
|
||||
grep "= 1: .* s/5/A" 0000-* &&
|
||||
grep "= 2: .* s/4/A" 0000-* &&
|
||||
grep "= 3: .* s/11/B" 0000-* &&
|
||||
grep "= 4: .* s/12/B" 0000-*
|
||||
'
|
||||
done
|
||||
|
||||
test_expect_success 'format-patch --range-diff as commentary' '
|
||||
git format-patch --stdout --range-diff=HEAD~1 HEAD~1 >actual &&
|
||||
test_i18ngrep "^Range-diff:$" actual
|
||||
git format-patch --range-diff=HEAD~1 HEAD~1 >actual &&
|
||||
test_when_finished "rm 0001-*" &&
|
||||
test_line_count = 1 actual &&
|
||||
test_i18ngrep "^Range-diff:$" 0001-* &&
|
||||
grep "> 1: .* new message" 0001-*
|
||||
'
|
||||
|
||||
test_done
|
||||
|
Loading…
Reference in New Issue
Block a user