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

Re: Support for config wildcards

From
Bill Lear <rael@zopyra.com>
Date
Mar 13, 2007, 18:10 UTC
Message-ID
<17910.59652.481204.872797@lisa.zopyra.com>
In-Reply-To
<7vird5jctl.fsf@assigned-by-dhcp.cox.net>
On Tuesday, March 13, 2007 at 10:03:18 (-0700) Junio C Hamano writes:
Show 17 quoted lines
>Bill Lear <rael@zopyra.com> writes:
>
>> Is there a way to do this sort of thing that I am missing?
>
>I think the way the config is designed is to place arbitrary
>values as values not variable names.
>
>Perhaps...
>
>	[mymailhook "everything"]
>        	recipients = me
>               branch = "*"
>
>	[mymailhook "all but xyz"]
>        	recipients = alice bob charlie
>               branch = "*"
>               branch = "!xyz"
Hmm, so in my example, if I had "abc" and "xyz"-specific lists:
	[mymailhook "abc"]
        	recipients = jim bob janet
                branch = "abc*"
	[mymailhook "xyz"]
        	recipients = alice bob charlie
                branch = "xyz*"
	[mymailhook "everything"]
               recipients = me
               branch = "*"

Then, I might, in the update hook, do this, given a branch for which to find the recipients ("to", below):

for key, pattern in $(git-config --get-regexp 'mymailhook.*.branch'); do
    label=${key#mailhook.}
    label=${label%.branch}
    if $(matches $pattern $branch); then
       to += $(git-config --get-regexp "mymailhook.${label}.recipients")
    fi
done

But that doesn't work for your example "all but xyz". I guess in that case, I would need to check both branch patterns and if one did not match, then I would reject it and not add to the recipient list.

Was that basically what you had in mind?
Bill
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 4 in “Support for config wildcards”
  1. Bill LearMar 13, 2007
  2. Junio C HamanoMar 13, 2007
  3. Bill LearMar 13, 2007
  4. Junio C HamanoMar 13, 2007

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.