{"thread":{"id":"7235","subject":"Support for config wildcards","startedAt":"2007-03-13T16:47:23Z","lastAt":"2007-03-13T19:50:26Z","messageCount":4,"participants":["Bill Lear","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"37012","messageId":"17910.54683.651029.884390@lisa.zopyra.com","threadId":"7235","inReplyTo":null,"subject":"Support for config wildcards","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-03-13T16:47:23Z","receivedAt":"2007-03-13T16:47:23Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"I would like to use our update hook to send email to recipients based\non a branch name pattern.  For example, the \"abc\" team would get email\nfor all updates to branches that start with the word \"abc\".\n\nI would like to write something like this in the config file:\n\n[hooks.mail.recipients]\n        xyz.pickle = me, you, betty-sue\n        xyz* = joe, jaya, julie\n        abc* = mark, nancy, svetlana\n        taug* = sridhar, pete, joe\n        * = me, you, big-boss\n\nThen, in the update hook, do something like this (very\npseudo-code-ish):\n\n    for key, value in $(git config --get-regexp hooks.mail.recipients*); do\n        key=${key#hooks.mail.recipients}\n        if $(matches $key $branch); then\n            recipients=$value\n            break\n        fi\n    done\n\nWhich would allow me to change the mailing list recipients based\non the branch without having to update the update hook each time.\n\nBut, apparently at least the '*' and '.' characters are not allowed as\nkeys, and I can't seem to escape them.\n\nIs there a way to do this sort of thing that I am missing?\n\n\nBill\n"},{"id":"37014","messageId":"7vird5jctl.fsf@assigned-by-dhcp.cox.net","threadId":"7235","inReplyTo":"17910.54683.651029.884390@lisa.zopyra.com","subject":"Re: Support for config wildcards","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-03-13T17:03:18Z","receivedAt":"2007-03-13T17:03:18Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Bill Lear <rael@zopyra.com> writes:\n\n> Is there a way to do this sort of thing that I am missing?\n\nI think the way the config is designed is to place arbitrary\nvalues as values not variable names.\n\nPerhaps...\n\n\t[mymailhook \"everything\"]\n        \trecipients = me\n                branch = \"*\"\n\n\t[mymailhook \"all but xyz\"]\n        \trecipients = alice bob charlie\n                branch = \"*\"\n                branch = \"!xyz\"\n"},{"id":"37020","messageId":"17910.59652.481204.872797@lisa.zopyra.com","threadId":"7235","inReplyTo":"7vird5jctl.fsf@assigned-by-dhcp.cox.net","subject":"Re: Support for config wildcards","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-03-13T18:10:12Z","receivedAt":"2007-03-13T18:10:12Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Tuesday, March 13, 2007 at 10:03:18 (-0700) Junio C Hamano writes:\n>Bill Lear <rael@zopyra.com> writes:\n>\n>> Is there a way to do this sort of thing that I am missing?\n>\n>I think the way the config is designed is to place arbitrary\n>values as values not variable names.\n>\n>Perhaps...\n>\n>\t[mymailhook \"everything\"]\n>        \trecipients = me\n>               branch = \"*\"\n>\n>\t[mymailhook \"all but xyz\"]\n>        \trecipients = alice bob charlie\n>               branch = \"*\"\n>               branch = \"!xyz\"\n\nHmm, so in my example, if I had \"abc\" and \"xyz\"-specific lists:\n\n\t[mymailhook \"abc\"]\n        \trecipients = jim bob janet\n                branch = \"abc*\"\n\n\t[mymailhook \"xyz\"]\n        \trecipients = alice bob charlie\n                branch = \"xyz*\"\n\n\t[mymailhook \"everything\"]\n               recipients = me\n               branch = \"*\"\n\nThen, I might, in the update hook, do this, given a branch for which\nto find the recipients (\"to\", below):\n\nfor key, pattern in $(git-config --get-regexp 'mymailhook.*.branch'); do\n    label=${key#mailhook.}\n    label=${label%.branch}\n    if $(matches $pattern $branch); then\n       to += $(git-config --get-regexp \"mymailhook.${label}.recipients\")\n    fi\ndone\n\nBut that doesn't work for your example \"all but xyz\".  I guess in that\ncase, I would need to check both branch patterns and if one did not\nmatch, then I would reject it and not add to the recipient list.\n\nWas that basically what you had in mind?\n\n\nBill\n"},{"id":"37026","messageId":"7v8xe0j531.fsf@assigned-by-dhcp.cox.net","threadId":"7235","inReplyTo":"17910.59652.481204.872797@lisa.zopyra.com","subject":"Re: Support for config wildcards","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-03-13T19:50:26Z","receivedAt":"2007-03-13T19:50:26Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Bill Lear <rael@zopyra.com> writes:\n\n> But that doesn't work for your example \"all but xyz\".  I guess in that\n> case, I would need to check both branch patterns and if one did not\n> match, then I would reject it and not add to the recipient list.\n>\n> Was that basically what you had in mind?\n\nYes, similar to how positive and negative entries in .gitignore\ninfluences the final outcome of the 'ignoredness' for each path.\n"}]}