2.36 format-patch regression fix
commit91f8f7e46fd86f2d20e93e00af451bf75febfe18
authorRené Scharfe <l.s.r@web.de>
Sat, 30 Apr 2022 10:32:44 +0000 (30 12:32 +0200)
committerJunio C Hamano <gitster@pobox.com>
Sat, 30 Apr 2022 18:49:59 +0000 (30 11:49 -0700)
tree3ae43d27db87e45c24c6f3491987d0214ba04001
parent362f869ff2dbc389234ecd8c4b996a9e507c39d7
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>
builtin/log.c
t/t4014-format-patch.sh