appending a pattern to the default "diff.cpp.xfuncname"
Hi,
I've used diff.<TYPE>.xfuncname with great success for file <TYPE>s that I defined myself. However, now I would like to append an extra pattern to the TYPE=cpp case (for which git has builtin patterns). Is there an easy way to do this?
I figured I could open-code the builtin patterns from "userdiff.c", and then append my new pattern to those, but it looks kinda gross :)
Thanks!
Laszlo
Quoted 7 lines · Laszlo Ersek
I've used diff.<TYPE>.xfuncname with great success for file <TYPE>s that I defined myself. However, now I would like to append an extra pattern to the TYPE=cpp case (for which git has builtin patterns). Is there an easy way to do this?
I figured I could open-code the builtin patterns from "
userdiff.c", and then append my new pattern to those, but it looks kinda gross :)
Unfortunately, no, the config system has no notion of "append to this value". So you are stuck with extracting the builtin value (which annoyingly, you cannot even get without looking at the source code!), and repeating it in your config file.
-Peff
Quoted 7 lines · Jeff King
Quoted 5 lines · Laszlo Ersek
I've used diff.<TYPE>.xfuncname with great success for file <TYPE>s that I defined myself. However, now I would like to append an extra pattern to the TYPE=cpp case (for which git has builtin patterns). Is there an easy way to do this?
Quoted 7 lines
Quoted 2 lines
I figured I could open-code the builtin patterns from "
userdiff.c", and then append my new pattern to those, but it looks kinda gross :)Unfortunately, no, the config system has no notion of "append to this value". So you are stuck with extracting the builtin value (which annoyingly, you cannot even get without looking at the source code!), and repeating it in your config file.
Thank you for confirming!
Laszlo
W dniu 03.08.2016 o 20:02, Jeff King pisze:
Quoted 7 lines · Laszlo Ersek
Quoted 6 lines
I've used diff.<TYPE>.xfuncname with great success for file <TYPE>s that I defined myself. However, now I would like to append an extra pattern to the TYPE=cpp case (for which git has builtin patterns). Is there an easy way to do this?
Quoted 5 lines
Quoted 2 lines
I figured I could open-code the builtin patterns from "
userdiff.c", and then append my new pattern to those, but it looks kinda gross :)Unfortunately, no, the config system has no notion of "append to this value".
And I think adding such capability would not be easy. Well, perhaps we could support '+=' in addition to '='?
Quoted 3 lines
So you are stuck with extracting the builtin value (which
annoyingly, you cannot even get without looking at the source code!), and repeating it in your config file.
I wonder if git var -l could provide all default values :-P
Signature · 1 line
Jakub Narębski
Quoted 5 lines · Jakub Narębski
Quoted 2 lines
Unfortunately, no, the config system has no notion of "append to this value".
And I think adding such capability would not be easy. Well, perhaps we could support '+=' in addition to '='?
We could, but it would be an incompatible syntactic change, which we've so far managed to avoid.
Quoted 5 lines
Quoted 3 lines
So you are stuck with extracting the builtin value (which
annoyingly, you cannot even get without looking at the source code!), and repeating it in your config file.I wonder if
git var -lcould provide all default values :-P
I had a similar thought, but it's quite difficult because of the way that default values are structured in git. Most code uses initialization of C variables (including structs) to set up default values, and then overrides them if it sees relevant config.
So there is no central code to ask "what is the value of X if I don't provide any config"? It literally requires dumping a bunch of variables.
One thing we could do is move all of those defaults into an "internal" config that is baked into the executable, and then parse that at the lowest-priority level of config. And then "git config --list --show-origin" could presumably just dump it.
But that would mean parsing it at run-time in every program (which is probably not _that_ much overhead, but does feel wrong). I'd also suspect there are a few cases whose defaults are expressed in code, rather than as single variable assignments, and couldn't be represented as config at all.
-Peff