On Tue, Apr 06, 2021 at 12:15:28PM +0200, Nikita Bobko wrote: > Steps to reproduce: > 1. Run `git -c diff.noprefix=true add -p` > > Expected behavior: > `a/` and `b/` prefixes are not shown during interactive `add` > like this: > [...] > Actual behavior: > `a/` and `b/` prefixes are shown instead. Like this: That's not too surprising. The add-interactive script is built around the diff-tree plumbing command, which does not respect a lot of "cosmetic" config, especially if it would make the diff hard to parse. So the add-interactive command would have to manually plumb through the config option, like we do for some other options. In this case, I think you'd want to enable the option only for the version of the diff we show to the user (since the machine-readable one has to actually be parsed by git-apply). This is what we do for supporting color diffs, for example. I imagine something like this: diff --git a/git-add--interactive.perl b/git-add--interactive.perl index bc3a1e8eff..1a249e15cb 100755 --- a/git-add--interactive.perl +++ b/git-add--interactive.perl @@ -43,6 +43,12 @@ $repo->get_color('color.diff.new', 'green'), ) : (); +# options to feed to diff to produce human-readable version +my @human_diff_opts = ( + $diff_use_color ? '--color' : (), + $repo->config_bool('diff.noprefix') ? qw(--no-prefix) : (), +); + my $normal_color = $repo->get_color("", "reset"); my $diff_algorithm = $repo->config('diff.algorithm'); @@ -714,8 +720,8 @@ sub parse_diff { } my @diff = run_cmd_pipe("git", @diff_cmd, qw(--no-color --), $path); my @colored = (); - if ($diff_use_color) { - my @display_cmd = ("git", @diff_cmd, qw(--color --), $path); + if (@human_diff_opts) { + my @display_cmd = ("git", @diff_cmd, @human_diff_opts, '--', $path); if (defined $diff_filter) { # quotemeta is overkill, but sufficient for shell-quoting my $diff = join(' ', map { quotemeta } @display_cmd); would work, but I didn't really test it. There's another hitch, which is that this subsystem has all been re-written in C. So we'd really want to implement it in the new code (possibly in both places, though maybe it is time to consider cutting over from the perl script to the C one by deafult?). But hopefully this illustrates the general idea, and gives somebody interested in the feature enough to work up their own patch. -Peff