With diff.noprefix enabled the patch generated with format-patch does not include prefix a/ and b/ so not applicable with `git am`. Solution is to force a_prefix and b_prefix on diffopt. Signed-off-by: Laurent Arnoud <laurent@xxxxxxxxxx> --- builtin/log.c | 2 ++ t/t4014-format-patch.sh | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/builtin/log.c b/builtin/log.c index d104d5c688..ca63f8ceda 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -1744,6 +1744,8 @@ 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.a_prefix = "a/"; + rev.diffopt.b_prefix = "b/"; rev.subject_prefix = fmt_patch_subject_prefix; memset(&s_r_opt, 0, sizeof(s_r_opt)); s_r_opt.def = "HEAD"; diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh index db7e733af9..5d7930e106 100755 --- a/t/t4014-format-patch.sh +++ b/t/t4014-format-patch.sh @@ -1602,6 +1602,14 @@ test_expect_success 'format patch ignores color.ui' ' test_cmp expect actual ' +test_expect_success 'format patch ignores diff.noprefix' ' + test_unconfig diff.noprefix && + git format-patch --stdout -1 >expect && + test_config diff.noprefix true && + git format-patch --stdout -1 >actual && + test_cmp expect actual +' + test_expect_success 'cover letter with invalid --cover-from-description and config' ' test_config branch.rebuild-1.description "config subject -- 2.27.0.rc2.129.g29f2dd231a