Perhaps we want {diff,log,format}.noprefix and friends?
From: Junio C Hamano <hidden>
Date: 2022-05-18 17:21:46
quoted
git -c diff.noprefix=no format-patch ... to cancel the config. (If that config really does want to be on, that is.) That said, something like git am -p0 ... should help on the receiving side, by way of skipping fewer path components when applying the patch.
While it is very reasonable for end-users to make the output of their local "git diff" output to their taste by setting the diff.noprefix and other configuration options in the diff.* namespace, it is wrong to inflict such a personal preference on other project participants by sending such a no-prefix patch via "git format-patch", when the convention at the receiving project is to use "git am -p1" to accept them. We would need to tweak the configuration system so that we can more easily introduce "format.noprefix" that overrides "diff.noprefix" only when the command being run is "git format-patch", perhaps? As things stand, we could teach builtin/log.c::git_format_config() about "format.noprefix" and make "git format-patch" pay attention to that in addition to "diff.noprefix" fairly easily, but such an approach poorly scales. When a new configuration gets introduced in diff.c::git_diff_ui_config(), builtin/log.c::git_format_config() would also need to be updated. I initially started writing this with "left over bits" mark, but it seems it is a bit larger in scope than that. I also noticed that some format.* configuration variables are parsed in git_log_config(), not git_format_config(), so "git log" would end up honoring format.pretty and format.subjectprefix, etc., which look wrong but probably is way too late to "fix".