Merge branch 'rs/range-diff-avoid-segfault-with-I'

"git range-diff -I... <range> <range>" segfaulted, which has been
corrected.

* rs/range-diff-avoid-segfault-with-I:
  range-diff: avoid segfault with -I
This commit is contained in:
Junio C Hamano 2021-09-15 13:15:27 -07:00
Родитель 1ea5e46cb9 709b3f32d3
Коммит 3d141d8789
1 изменённых файлов: 3 добавлений и 0 удалений

Просмотреть файл

@ -482,6 +482,7 @@ static void output(struct string_list *a, struct string_list *b,
else
diff_setup(&opts);
opts.no_free = 1;
if (!opts.output_format)
opts.output_format = DIFF_FORMAT_PATCH;
opts.flags.suppress_diff_headers = 1;
@ -542,6 +543,8 @@ static void output(struct string_list *a, struct string_list *b,
strbuf_release(&buf);
strbuf_release(&dashes);
strbuf_release(&indent);
opts.no_free = 0;
diff_free(&opts);
}
int show_range_diff(const char *range1, const char *range2,