git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git add -p doesn't honor diff.noprefix config

From
Jeff King <peff@peff.net>
Date
Dec 6, 2016, 13:56 UTC
Message-ID
<20161206135650.wv5cw3at4tqgpp6o@sigill.intra.peff.net>
In-Reply-To
<E1D7329A-A54B-4D09-A72A-62ECA8005752@gmail.com>
On Sat, Dec 03, 2016 at 07:45:18AM +0100, paddor wrote:
Show 6 quoted lines
> I set the config diff.noprefix = true because I don't like the a/ and
> b/ prefixes, which nicely changed the output of `git diff`.
> Unfortunately, the filenames in the output of `git add --patch` are
> still prefixed.
> 
> To me, this seems like a bug. Or there's a config option missing.

The interactive-add process is a perl script built around plumbing commands like diff-tree, diff-files, etc. Plumbing commands do not respect some config options, so that the output remains stable or scripts built around them. And diff.noprefix is one of these. So scripts have to get the value themselves and decide whether to pass it along to the plumbing.

In this case, I think there are two steps needed:
  1. Confirm that git-add--interactive.perl can actually handle
     no-prefix patches. It feeds the patches back to git-apply, which
     may be a complication (so it may need, for example, to pass a
     special flag to git-apply).
  2. git-add--interactive.perl needs to parse the config value, and if
     set, pass the appropriate option to the diff plumbing. This should
     only be one or two lines; see how $diff_algorithm is handled in
     that script.
-Peff
Previous: paddor
Message 2 of 2 in “git add -p doesn't honor diff.noprefix config”
  1. paddorDec 3, 2016
  2. Jeff KingDec 6, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.