2.36 format-patch regression fix
e900d494dc(diff: add an API for deferred freeing, 2021-02-11) added a way to allow reusing diffopts: the no_free bit.244c27242f(diff.[ch]: have diff_free() call clear_pathspec(opts.pathspec), 2022-02-16) made that mechanism mandatory. git format-patch only sets no_free when --output is given, causing it to forget pathspecs after the first commit. Set no_free unconditionally instead. The existing test was unable to detect this breakage because it checks stderr for the absence of a certain string, but format-patch writes to stdout. Also the test was not checking the case of one commit modifying multiple files and a pathspec limiting the diff. Replace it with a more thorough one. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
362f869ff2
commit
91f8f7e46f
@ -1883,6 +1883,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
|
||||
rev.diff = 1;
|
||||
rev.max_parents = 1;
|
||||
rev.diffopt.flags.recursive = 1;
|
||||
rev.diffopt.no_free = 1;
|
||||
rev.subject_prefix = fmt_patch_subject_prefix;
|
||||
memset(&s_r_opt, 0, sizeof(s_r_opt));
|
||||
s_r_opt.def = "HEAD";
|
||||
@ -2008,13 +2009,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
|
||||
|
||||
if (use_stdout) {
|
||||
setup_pager();
|
||||
} else if (rev.diffopt.close_file) {
|
||||
/*
|
||||
* The diff code parsed --output; it has already opened the
|
||||
* file, but we must instruct it not to close after each diff.
|
||||
*/
|
||||
rev.diffopt.no_free = 1;
|
||||
} else {
|
||||
} else if (!rev.diffopt.close_file) {
|
||||
int saved;
|
||||
|
||||
if (!output_directory)
|
||||
|
||||
Reference in New Issue
Block a user