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

Re: [PATCH v3] diff: add diff.srcPrefix and diff.dstPrefix configuration variables

From
PWPhillip Wood <phillip.wood123@gmail.com>
Date
Mar 13, 2024, 16:18 UTC
Message-ID
<9449a421-c6ea-427c-a600-73c6f99ccf0d@gmail.com>
In-Reply-To
<xmqqbk7if8vj.fsf@gitster.g>
On 13/03/2024 15:29, Junio C Hamano wrote:
Show 13 quoted lines
> Phillip Wood <phillip.wood123@gmail.com> writes:
> 
>>> With a custom prefix those scripts will break, having an option that
>>> forces the a/ and b/ prefix helps. Plus the man page explicitly says:
>>>     Use the default source and destination prefixes ("a/" and "b/").
>>> So let's stick with that behaviour then.
>>
>> As I understand it the purpose of --default-prefix is to override all
>> the prefix related config settings so this seems like a very sensible
>> choice.
> 
> It would be nice to update the description of '--default-prefix' so
> that nobody has to say "As I understand it" anymore ;-)
That's a good idea
Show 22 quoted lines
> As we are selling .{src,dst}Prefix as a thing that sets the default
> prefix, we'd need to break the loop somehow, and "hardcoded" below
> is my attempt to do so, but I am not sure if I succeeded.
> 
>   Documentation/diff-options.txt | 7 ++++---
>   1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git c/Documentation/diff-options.txt w/Documentation/diff-options.txt
> index aaaff0d46f..62eaa46d84 100644
> --- c/Documentation/diff-options.txt
> +++ w/Documentation/diff-options.txt
> @@ -864,9 +864,10 @@ endif::git-format-patch[]
>   	Do not show any source or destination prefix.
>   
>   --default-prefix::
> -	Use the default source and destination prefixes ("a/" and "b/").
> -	This is usually the default already, but may be used to override
> -	config such as `diff.noprefix`.
> +	Use the hardcoded default source and destination prefixes
> +	("a/" and "b/").  This is designed to be used to override
> +	configuration variables such as `diff.noprefix` and
> +	`diff.srcPrefix`.

That looks clear to me. I think the only other config variable that affects the prefix is "diff.mnemonicPrefix" so if we're going to update the description to mention "diff.srcPrefix" maybe we should mention that one as well or just say something like "This is designed to be used to override the configuration variables `diff.*Prefix`.".

Best Wishes
Phillip
>   --line-prefix=<prefix>::
>   	Prepend an additional prefix to every line of output.
Previous: Junio C HamanoNext: Junio C Hamano
Message 15 of 28 in “diff: add diff.srcprefix and diff.dstprefix option support”
  1. diff: add diff.srcprefix and diff.dstprefix option supportPeter Hutterer, Mar 11, 2024
  2. Junio C HamanoMar 11, 2024
  3. diff: add diff.srcprefix and diff.dstprefix configuration variablesPeter Hutterer, Mar 12, 2024
  4. Junio C HamanoMar 12, 2024
  5. Dragan SimicMar 12, 2024
  6. diff: add diff.srcPrefix and diff.dstPrefix configuration variablesPeter Hutterer, Mar 12, 2024
  7. Dragan SimicMar 13, 2024
  8. Dragan SimicMar 13, 2024
  9. Phillip WoodMar 13, 2024
  10. Dragan SimicMar 13, 2024
  11. Junio C HamanoMar 13, 2024
  12. Dragan SimicMar 13, 2024
  13. Phillip WoodMar 13, 2024
  14. Junio C HamanoMar 13, 2024
  15. Phillip WoodMar 13, 2024
  16. Junio C HamanoMar 13, 2024
  17. Peter HuttererMar 14, 2024
  18. Dragan SimicMar 13, 2024
  19. diff: add diff.srcPrefix and diff.dstPrefix configuration variablesPeter Hutterer, Mar 15, 2024
  20. Dragan SimicMar 15, 2024
  21. diff: add diff.srcPrefix and diff.dstPrefix configuration variablesPeter Hutterer, Mar 15, 2024
  22. Dragan SimicMar 15, 2024
  23. Junio C HamanoMar 15, 2024
  24. Dragan SimicMar 15, 2024
  25. Junio C HamanoMar 16, 2024
  26. Dragan SimicMar 16, 2024
  27. Peter HuttererMar 18, 2024
  28. Junio C HamanoMar 18, 2024

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.