{"thread":{"id":"18039","subject":"Checking for a valid email address","startedAt":"2009-02-27T03:28:59Z","lastAt":"2009-02-27T16:20:02Z","messageCount":6,"participants":["Adam Mercer","Miklos Vajna","demerphq"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"106391","messageId":"799406d60902261928q2c691112yf24d01b92a3dad6c@mail.gmail.com","threadId":"18039","inReplyTo":null,"subject":"Checking for a valid email address","fromName":"Adam Mercer","fromEmail":"ramercer@gmail.com","sentAt":"2009-02-27T03:28:59Z","receivedAt":"2009-02-27T03:28:59Z","isPatch":false,"sender":{"key":"ramercer@gmail.com","avatar":"https://gravatar.com/avatar/16dc719817f62b75075d529ce4ea992ee82bb1a08e45a3029797f39223d6ee64?d=mp&s=160"},"body":"Hi\n\nWe are in the process of migrating some of our repositories from CVS\nto Git in a two step process, first to a centralised Git setup then\n(hopefully) onto a more distributed development model. In the testing\nwe have been doing so far the only problem we have run into is\ndevelopers not setting their email addresses correctly so the\nchangelogs are filled with spurious address. Does anyone know of a\npre-commit hook that could check for a valid email address prior to\nallowing a commit? Or another way that this can be acheived?\n\nCheers\n\nAdam\n"},{"id":"106413","messageId":"20090227090807.GQ4371@genesis.frugalware.org","threadId":"18039","inReplyTo":"799406d60902261928q2c691112yf24d01b92a3dad6c@mail.gmail.com","subject":"Re: Checking for a valid email address","fromName":"Miklos Vajna","fromEmail":"vmiklos@frugalware.org","sentAt":"2009-02-27T09:08:07Z","receivedAt":"2009-02-27T09:08:07Z","isPatch":false,"sender":{"key":"vmiklos@frugalware.org","avatar":"https://gravatar.com/avatar/401c1cbbb3a5d13e650c691a2c71d6fd0b80df1a01bc74d9f1972675dd58f2bd?d=mp&s=160"},"body":"On Thu, Feb 26, 2009 at 09:28:59PM -0600, Adam Mercer <ramercer@gmail.com> wrote:\n> We are in the process of migrating some of our repositories from CVS\n> to Git in a two step process, first to a centralised Git setup then\n> (hopefully) onto a more distributed development model. In the testing\n> we have been doing so far the only problem we have run into is\n> developers not setting their email addresses correctly so the\n> changelogs are filled with spurious address. Does anyone know of a\n> pre-commit hook that could check for a valid email address prior to\n> allowing a commit? Or another way that this can be acheived?\n\nYou can use a script like this:\n\nhttp://www.perl.com/CPAN/authors/Tom_Christiansen/scripts/ckaddr.gz\n\nOther helpful git commands to get the current email address:\n\ngit var GIT_AUTHOR_IDENT\ngit config user.name\ngit config user.email\n\nYou can do the rest, hopefully. :)\n"},{"id":"106415","messageId":"9b18b3110902270120t15babbc0oe2975c086297e1e0@mail.gmail.com","threadId":"18039","inReplyTo":"799406d60902261928q2c691112yf24d01b92a3dad6c@mail.gmail.com","subject":"Re: Checking for a valid email address","fromName":"demerphq","fromEmail":"demerphq@gmail.com","sentAt":"2009-02-27T09:20:33Z","receivedAt":"2009-02-27T09:20:33Z","isPatch":false,"sender":{"key":"demerphq@gmail.com","avatar":null},"body":"2009/2/27 Adam Mercer <ramercer@gmail.com>:\n> Hi\n>\n> We are in the process of migrating some of our repositories from CVS\n> to Git in a two step process, first to a centralised Git setup then\n> (hopefully) onto a more distributed development model. In the testing\n> we have been doing so far the only problem we have run into is\n> developers not setting their email addresses correctly so the\n> changelogs are filled with spurious address. Does anyone know of a\n> pre-commit hook that could check for a valid email address prior to\n> allowing a commit? Or another way that this can be acheived?\n\nIf you are using Perl 5.10 or later then you can use the following regex:\n\nmy $email = qr {\n    (?(DEFINE)\n      (?<address>         (?&mailbox) | (?&group))\n      (?<mailbox>         (?&name_addr) | (?&addr_spec))\n      (?<name_addr>       (?&display_name)? (?&angle_addr))\n      (?<angle_addr>      (?&CFWS)? < (?&addr_spec) > (?&CFWS)?)\n      (?<group>           (?&display_name) : (?:(?&mailbox_list) | (?&CFWS))? ;\n                                             (?&CFWS)?)\n      (?<display_name>    (?&phrase))\n      (?<mailbox_list>    (?&mailbox) (?: , (?&mailbox))*)\n\n      (?<addr_spec>       (?&local_part) \\@ (?&domain))\n      (?<local_part>      (?&dot_atom) | (?&quoted_string))\n      (?<domain>          (?&dot_atom) | (?&domain_literal))\n      (?<domain_literal>  (?&CFWS)? \\[ (?: (?&FWS)? (?&dcontent))* (?&FWS)?\n                                    \\] (?&CFWS)?)\n      (?<dcontent>        (?&dtext) | (?&quoted_pair))\n      (?<dtext>           (?&NO_WS_CTL) | [\\x21-\\x5a\\x5e-\\x7e])\n\n      (?<atext>           (?&ALPHA) | (?&DIGIT) | [!#\\$%&'*+-/=?^_`{|}~])\n      (?<atom>            (?&CFWS)? (?&atext)+ (?&CFWS)?)\n      (?<dot_atom>        (?&CFWS)? (?&dot_atom_text) (?&CFWS)?)\n      (?<dot_atom_text>   (?&atext)+ (?: \\. (?&atext)+)*)\n\n      (?<text>            [\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])\n      (?<quoted_pair>     \\\\ (?&text))\n\n      (?<qtext>           (?&NO_WS_CTL) | [\\x21\\x23-\\x5b\\x5d-\\x7e])\n      (?<qcontent>        (?&qtext) | (?&quoted_pair))\n      (?<quoted_string>   (?&CFWS)? (?&DQUOTE) (?:(?&FWS)? (?&qcontent))*\n                           (?&FWS)? (?&DQUOTE) (?&CFWS)?)\n\n      (?<word>            (?&atom) | (?&quoted_string))\n      (?<phrase>          (?&word)+)\n\n      # Folding white space\n      (?<FWS>             (?: (?&WSP)* (?&CRLF))? (?&WSP)+)\n      (?<ctext>           (?&NO_WS_CTL) | [\\x21-\\x27\\x2a-\\x5b\\x5d-\\x7e])\n      (?<ccontent>        (?&ctext) | (?&quoted_pair) | (?&comment))\n      (?<comment>         \\( (?: (?&FWS)? (?&ccontent))* (?&FWS)? \\) )\n      (?<CFWS>            (?: (?&FWS)? (?&comment))*\n                          (?: (?:(?&FWS)? (?&comment)) | (?&FWS)))\n\n      # No whitespace control\n      (?<NO_WS_CTL>       [\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f])\n\n      (?<ALPHA>           [A-Za-z])\n      (?<DIGIT>           [0-9])\n      (?<CRLF>            \\x0d \\x0a)\n      (?<DQUOTE>          \")\n      (?<WSP>             [\\x20\\x09])\n    )\n\n    (?&address)\n}x;\n\nwhich is a fully RFC compliant perl regex for validating any email address.\n\nHave fun, and if you use it credit Abigail of the Perl community for\nwriting it.\n\ncheers,\nYves\n\n-- \nperl -Mre=debug -e \"/just|another|perl|hacker/\"\n"},{"id":"106416","messageId":"9b18b3110902270125p76ac118ckd21cb2d427940db2@mail.gmail.com","threadId":"18039","inReplyTo":"9b18b3110902270120t15babbc0oe2975c086297e1e0@mail.gmail.com","subject":"Re: Checking for a valid email address","fromName":"demerphq","fromEmail":"demerphq@gmail.com","sentAt":"2009-02-27T09:25:12Z","receivedAt":"2009-02-27T09:25:12Z","isPatch":false,"sender":{"key":"demerphq@gmail.com","avatar":null},"body":"2009/2/27 demerphq <demerphq@gmail.com>:\n> 2009/2/27 Adam Mercer <ramercer@gmail.com>:\n>> Hi\n>>\n>> We are in the process of migrating some of our repositories from CVS\n>> to Git in a two step process, first to a centralised Git setup then\n>> (hopefully) onto a more distributed development model. In the testing\n>> we have been doing so far the only problem we have run into is\n>> developers not setting their email addresses correctly so the\n>> changelogs are filled with spurious address. Does anyone know of a\n>> pre-commit hook that could check for a valid email address prior to\n>> allowing a commit? Or another way that this can be acheived?\n>\n> If you are using Perl 5.10 or later then you can use the following regex:\n>\n> my $email = qr {\n>    (?(DEFINE)\n>      (?<address>         (?&mailbox) | (?&group))\n>      (?<mailbox>         (?&name_addr) | (?&addr_spec))\n>      (?<name_addr>       (?&display_name)? (?&angle_addr))\n>      (?<angle_addr>      (?&CFWS)? < (?&addr_spec) > (?&CFWS)?)\n>      (?<group>           (?&display_name) : (?:(?&mailbox_list) | (?&CFWS))? ;\n>                                             (?&CFWS)?)\n>      (?<display_name>    (?&phrase))\n>      (?<mailbox_list>    (?&mailbox) (?: , (?&mailbox))*)\n>\n>      (?<addr_spec>       (?&local_part) \\@ (?&domain))\n>      (?<local_part>      (?&dot_atom) | (?&quoted_string))\n>      (?<domain>          (?&dot_atom) | (?&domain_literal))\n>      (?<domain_literal>  (?&CFWS)? \\[ (?: (?&FWS)? (?&dcontent))* (?&FWS)?\n>                                    \\] (?&CFWS)?)\n>      (?<dcontent>        (?&dtext) | (?&quoted_pair))\n>      (?<dtext>           (?&NO_WS_CTL) | [\\x21-\\x5a\\x5e-\\x7e])\n>\n>      (?<atext>           (?&ALPHA) | (?&DIGIT) | [!#\\$%&'*+-/=?^_`{|}~])\n>      (?<atom>            (?&CFWS)? (?&atext)+ (?&CFWS)?)\n>      (?<dot_atom>        (?&CFWS)? (?&dot_atom_text) (?&CFWS)?)\n>      (?<dot_atom_text>   (?&atext)+ (?: \\. (?&atext)+)*)\n>\n>      (?<text>            [\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])\n>      (?<quoted_pair>     \\\\ (?&text))\n>\n>      (?<qtext>           (?&NO_WS_CTL) | [\\x21\\x23-\\x5b\\x5d-\\x7e])\n>      (?<qcontent>        (?&qtext) | (?&quoted_pair))\n>      (?<quoted_string>   (?&CFWS)? (?&DQUOTE) (?:(?&FWS)? (?&qcontent))*\n>                           (?&FWS)? (?&DQUOTE) (?&CFWS)?)\n>\n>      (?<word>            (?&atom) | (?&quoted_string))\n>      (?<phrase>          (?&word)+)\n>\n>      # Folding white space\n>      (?<FWS>             (?: (?&WSP)* (?&CRLF))? (?&WSP)+)\n>      (?<ctext>           (?&NO_WS_CTL) | [\\x21-\\x27\\x2a-\\x5b\\x5d-\\x7e])\n>      (?<ccontent>        (?&ctext) | (?&quoted_pair) | (?&comment))\n>      (?<comment>         \\( (?: (?&FWS)? (?&ccontent))* (?&FWS)? \\) )\n>      (?<CFWS>            (?: (?&FWS)? (?&comment))*\n>                          (?: (?:(?&FWS)? (?&comment)) | (?&FWS)))\n>\n>      # No whitespace control\n>      (?<NO_WS_CTL>       [\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f])\n>\n>      (?<ALPHA>           [A-Za-z])\n>      (?<DIGIT>           [0-9])\n>      (?<CRLF>            \\x0d \\x0a)\n>      (?<DQUOTE>          \")\n>      (?<WSP>             [\\x20\\x09])\n>    )\n>\n>    (?&address)\n> }x;\n>\n> which is a fully RFC compliant perl regex for validating any email address.\n\nEr, i meant validating whether any email address is well formed of course.\n\nCheers,\nyves\n\n\n\n-- \nperl -Mre=debug -e \"/just|another|perl|hacker/\"\n"},{"id":"106443","messageId":"799406d60902270819x610704a4qc93a979b2a08c918@mail.gmail.com","threadId":"18039","inReplyTo":"20090227090807.GQ4371@genesis.frugalware.org","subject":"Re: Checking for a valid email address","fromName":"Adam Mercer","fromEmail":"ramercer@gmail.com","sentAt":"2009-02-27T16:19:56Z","receivedAt":"2009-02-27T16:19:56Z","isPatch":false,"sender":{"key":"ramercer@gmail.com","avatar":"https://gravatar.com/avatar/16dc719817f62b75075d529ce4ea992ee82bb1a08e45a3029797f39223d6ee64?d=mp&s=160"},"body":"On Fri, Feb 27, 2009 at 03:08, Miklos Vajna <vmiklos@frugalware.org> wrote:\n\n> You can use a script like this:\n>\n> http://www.perl.com/CPAN/authors/Tom_Christiansen/scripts/ckaddr.gz\n>\n> Other helpful git commands to get the current email address:\n>\n> git var GIT_AUTHOR_IDENT\n> git config user.name\n> git config user.email\n>\n> You can do the rest, hopefully. :)\n\nThanks, thats helpful.\n\nCheers\n\nAdam\n"},{"id":"106444","messageId":"799406d60902270820r7edb16b2rab39ea7fd38a43c1@mail.gmail.com","threadId":"18039","inReplyTo":"9b18b3110902270125p76ac118ckd21cb2d427940db2@mail.gmail.com","subject":"Re: Checking for a valid email address","fromName":"Adam Mercer","fromEmail":"ramercer@gmail.com","sentAt":"2009-02-27T16:20:02Z","receivedAt":"2009-02-27T16:20:02Z","isPatch":false,"sender":{"key":"ramercer@gmail.com","avatar":"https://gravatar.com/avatar/16dc719817f62b75075d529ce4ea992ee82bb1a08e45a3029797f39223d6ee64?d=mp&s=160"},"body":"On Fri, Feb 27, 2009 at 03:25, demerphq <demerphq@gmail.com> wrote:\n\n>> If you are using Perl 5.10 or later then you can use the following regex:\n\n<snip>\n\n>> which is a fully RFC compliant perl regex for validating any email address.\n>\n> Er, i meant validating whether any email address is well formed of course.\n\nThanks, that should be enough...\n\nCheers\n\nAdam\n"}]}