Re: [PATCH 14/14] format-patch: allow --range-diff to apply to a lone-patch
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jul 25, 2018, 21:07 UTC
- Message-ID
- <xmqqr2jrt46j.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <20180722095717.17912-15-sunshine@sunshineco.com>
Eric Sunshine <sunshine@sunshineco.com> writes:
Show 21 quoted lines
> @@ -750,6 +751,20 @@ void show_log(struct rev_info *opt)
>
> memcpy(&diff_queued_diff, &dq, sizeof(diff_queued_diff));
> }
> +
> + if (cmit_fmt_is_mail(ctx.fmt) && opt->rdiff1) {
> + struct diff_queue_struct dq;
> +
> + 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);
> + show_range_diff(opt->rdiff1, opt->rdiff2,
> + opt->creation_factor, 1, &opt->diffopt);
> +
> + memcpy(&diff_queued_diff, &dq, sizeof(diff_queued_diff));
> + }
> }
>
> int log_tree_diff_flush(struct rev_info *opt)This essentially repeats what is already done for "interdiff".
Does the global diff_queued_diff gets cleaned up when show_interdiff() and show_range_diff() return, like diff_flush() does? Otherwise we'd be leaking the filepairs accumulated in the diff_queued_diff.