{"thread":{"id":"42994","subject":"appending a pattern to the default \"diff.cpp.xfuncname\"","startedAt":"2016-08-03T10:17:03Z","lastAt":"2016-08-03T19:00:03Z","messageCount":5,"participants":["Laszlo Ersek","Jeff King","Jakub Narębski"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"292889","messageId":"40ceebb8-b343-a5ca-e7ff-23cccc181528@redhat.com","threadId":"42994","inReplyTo":null,"subject":"appending a pattern to the default \"diff.cpp.xfuncname\"","fromName":"Laszlo Ersek","fromEmail":"lersek@redhat.com","sentAt":"2016-08-03T10:16:14Z","receivedAt":"2016-08-03T10:17:03Z","isPatch":false,"sender":{"key":"lersek@redhat.com","avatar":null},"body":"Hi,\n\nI've used diff.<TYPE>.xfuncname with great success for file <TYPE>s that\nI defined myself. However, now I would like to append an extra pattern\nto the TYPE=cpp case (for which git has builtin patterns). Is there an\neasy way to do this?\n\nI figured I could open-code the builtin patterns from \"userdiff.c\", and\nthen append my new pattern to those, but it looks kinda gross :)\n\nThanks!\nLaszlo\n"},{"id":"292956","messageId":"20160803180213.o7xpm4c4tw5rixmy@sigill.intra.peff.net","threadId":"42994","inReplyTo":"40ceebb8-b343-a5ca-e7ff-23cccc181528@redhat.com","subject":"Re: appending a pattern to the default \"diff.cpp.xfuncname\"","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-08-03T18:02:14Z","receivedAt":"2016-08-03T18:02:34Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Aug 03, 2016 at 12:16:14PM +0200, Laszlo Ersek wrote:\n\n> I've used diff.<TYPE>.xfuncname with great success for file <TYPE>s that\n> I defined myself. However, now I would like to append an extra pattern\n> to the TYPE=cpp case (for which git has builtin patterns). Is there an\n> easy way to do this?\n> \n> I figured I could open-code the builtin patterns from \"userdiff.c\", and\n> then append my new pattern to those, but it looks kinda gross :)\n\nUnfortunately, no, the config system has no notion of \"append to this\nvalue\". So you are stuck with extracting the builtin value (which\nannoyingly, you cannot even get without looking at the source code!),\nand repeating it in your config file.\n\n-Peff\n"},{"id":"292960","messageId":"03265a89-fbe8-653a-fb55-ca436c48e39d@redhat.com","threadId":"42994","inReplyTo":"20160803180213.o7xpm4c4tw5rixmy@sigill.intra.peff.net","subject":"Re: appending a pattern to the default \"diff.cpp.xfuncname\"","fromName":"Laszlo Ersek","fromEmail":"lersek@redhat.com","sentAt":"2016-08-03T18:12:19Z","receivedAt":"2016-08-03T18:23:03Z","isPatch":false,"sender":{"key":"lersek@redhat.com","avatar":null},"body":"On 08/03/16 20:02, Jeff King wrote:\n> On Wed, Aug 03, 2016 at 12:16:14PM +0200, Laszlo Ersek wrote:\n> \n>> I've used diff.<TYPE>.xfuncname with great success for file <TYPE>s that\n>> I defined myself. However, now I would like to append an extra pattern\n>> to the TYPE=cpp case (for which git has builtin patterns). Is there an\n>> easy way to do this?\n>>\n>> I figured I could open-code the builtin patterns from \"userdiff.c\", and\n>> then append my new pattern to those, but it looks kinda gross :)\n> \n> Unfortunately, no, the config system has no notion of \"append to this\n> value\". So you are stuck with extracting the builtin value (which\n> annoyingly, you cannot even get without looking at the source code!),\n> and repeating it in your config file.\n\nThank you for confirming!\nLaszlo\n\n"},{"id":"292964","messageId":"20160803184029.kg7xdcb5s7znxyjq@sigill.intra.peff.net","threadId":"42994","inReplyTo":"8c4e96b9-165f-5168-d220-6a1548ff83c7@gmail.com","subject":"Re: appending a pattern to the default \"diff.cpp.xfuncname\"","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-08-03T18:40:29Z","receivedAt":"2016-08-03T18:47:29Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Aug 03, 2016 at 08:34:28PM +0200, Jakub Narębski wrote:\n\n> > Unfortunately, no, the config system has no notion of \"append to this\n> > value\". \n> \n> And I think adding such capability would not be easy.  Well, perhaps\n> we could support '+=' in addition to '='?\n\nWe could, but it would be an incompatible syntactic change, which we've\nso far managed to avoid.\n\n> >         So you are stuck with extracting the builtin value (which\n> > annoyingly, you cannot even get without looking at the source code!),\n> > and repeating it in your config file.\n> \n> I wonder if `git var -l` could provide all default values :-P\n\nI had a similar thought, but it's quite difficult because of the way\nthat default values are structured in git. Most code uses initialization\nof C variables (including structs) to set up default values, and then\noverrides them if it sees relevant config.\n\nSo there is no central code to ask \"what is the value of X if I don't\nprovide any config\"? It literally requires dumping a bunch of variables.\n\nOne thing we could do is move all of those defaults into an \"internal\"\nconfig that is baked into the executable, and then parse that at the\nlowest-priority level of config. And then \"git config --list\n--show-origin\" could presumably just dump it.\n\nBut that would mean parsing it at run-time in every program (which is\nprobably not _that_ much overhead, but does feel wrong). I'd also\nsuspect there are a few cases whose defaults are expressed in code,\nrather than as single variable assignments, and couldn't be represented\nas config at all.\n\n-Peff\n"},{"id":"292965","messageId":"8c4e96b9-165f-5168-d220-6a1548ff83c7@gmail.com","threadId":"42994","inReplyTo":"20160803180213.o7xpm4c4tw5rixmy@sigill.intra.peff.net","subject":"Re: appending a pattern to the default \"diff.cpp.xfuncname\"","fromName":"Jakub Narębski","fromEmail":"jnareb@gmail.com","sentAt":"2016-08-03T18:34:28Z","receivedAt":"2016-08-03T19:00:03Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"W dniu 03.08.2016 o 20:02, Jeff King pisze:\n> On Wed, Aug 03, 2016 at 12:16:14PM +0200, Laszlo Ersek wrote:\n> \n>> I've used diff.<TYPE>.xfuncname with great success for file <TYPE>s that\n>> I defined myself. However, now I would like to append an extra pattern\n>> to the TYPE=cpp case (for which git has builtin patterns). Is there an\n>> easy way to do this?\n>>\n>> I figured I could open-code the builtin patterns from \"userdiff.c\", and\n>> then append my new pattern to those, but it looks kinda gross :)\n> \n> Unfortunately, no, the config system has no notion of \"append to this\n> value\". \n\nAnd I think adding such capability would not be easy.  Well, perhaps\nwe could support '+=' in addition to '='?\n\n>         So you are stuck with extracting the builtin value (which\n> annoyingly, you cannot even get without looking at the source code!),\n> and repeating it in your config file.\n\nI wonder if `git var -l` could provide all default values :-P\n\n-- \nJakub Narębski\n\n"}]}