{"thread":{"id":"21603","subject":"send an email with logs after push","startedAt":"2009-11-13T08:46:39Z","lastAt":"2009-11-13T14:18:06Z","messageCount":4,"participants":["michele","Pascal Obry","Matthieu Moy"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"127496","messageId":"1258101999.17624.1345023113@webmail.messagingengine.com","threadId":"21603","inReplyTo":null,"subject":"send an email with logs after push","fromName":"michele","fromEmail":"michele@mailc.net","sentAt":"2009-11-13T08:46:39Z","receivedAt":"2009-11-13T08:46:39Z","isPatch":false,"sender":{"key":"michele@mailc.net","avatar":null},"body":"Hi guys, I'm using git for a collaborative development and I'm trying to\nimplement a notification system. I want to automatically send an email\ncontaining the log of each commit after a push. The email should contain\nthe titles of the commits done between the previous and the last push.\nThe push action publish the repository on a public_html directory in one\nother machine.\n\nDo you have any suggestion to implement this?\n\nThanks\n"},{"id":"127498","messageId":"a2633edd0911130055y199955a2n93888b03c5f9b985@mail.gmail.com","threadId":"21603","inReplyTo":"1258101999.17624.1345023113@webmail.messagingengine.com","subject":"Re: send an email with logs after push","fromName":"Pascal Obry","fromEmail":"pascal@obry.net","sentAt":"2009-11-13T08:55:38Z","receivedAt":"2009-11-13T08:55:38Z","isPatch":false,"sender":{"key":"pascal@obry.net","avatar":"https://avatars.githubusercontent.com/u/467069?v=4"},"body":"Michele,\n\n> Do you have any suggestion to implement this?\n\nI'm doing that. In the post-receive hook I have:\n\n<<\nwhile read oldrev newrev ref; do\n    trac_post_receive_record_log \"$oldrev\" \"$newrev\" \"$ref\" gtest\n\n    send_mail_post_receive \"$oldrev\" \"$newrev\" \"$ref\" gtest \\\n\tpascal@obry.net another@here.com\ndone\n>>\n\nthe trac_post_receive_record_log is to add log into trac bug tracker.\n\nthe send_mail_post_receive is to send a message to the recipients\nlisted. The 4th parameter is the name of the project.\n\nThe send_mail_post_receive function is:\n\nfunction send_mail_post_receive() {\n    oldrev=$1\n    newrev=$2\n    ref=$3\n    MODULE=\"$4\"\n\n    git log -p $oldrev..$newrev > $log\n    cat $log | mail -s \"[$MODULE] $ref $oldrev..$newrev\" $5 $6 $7 $8 $9\n    rm -fr $root\n}\n\nYou'll find a set of hook helper routines there:\n\n   git clone http://repo.or.cz/r/git-scripts.git\n\nHope this helps!\n\nPascal.\n\n-- \n\n--|------------------------------------------------------\n--| Pascal Obry                           Team-Ada Member\n--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE\n--|------------------------------------------------------\n--|              http://www.obry.net\n--| \"The best way to travel is by means of imagination\"\n--|\n--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595\n"},{"id":"127506","messageId":"vpqocn6iu4l.fsf@bauges.imag.fr","threadId":"21603","inReplyTo":"a2633edd0911130055y199955a2n93888b03c5f9b985@mail.gmail.com","subject":"Re: send an email with logs after push","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2009-11-13T10:42:02Z","receivedAt":"2009-11-13T10:42:02Z","isPatch":false,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Pascal Obry <pascal@obry.net> writes:\n\n> Michele,\n>\n>> Do you have any suggestion to implement this?\n>\n> I'm doing that. In the post-receive hook I have:\n\nSee also post-receive-email in git/contrib/hooks/, probably installed\nsomewhere like by your distro. In the .git/hooks/post-receive.sample\ninstalled by default by \"git init\", this should be a matter of\nuncommenting one line.\n\n--\nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"127510","messageId":"1258121886.28608.1345063845@webmail.messagingengine.com","threadId":"21603","inReplyTo":"vpqocn6iu4l.fsf@bauges.imag.fr","subject":"Re: send an email with logs after push","fromName":"michele","fromEmail":"michele@mailc.net","sentAt":"2009-11-13T14:18:06Z","receivedAt":"2009-11-13T14:18:06Z","isPatch":false,"sender":{"key":"michele@mailc.net","avatar":null},"body":"On Fri, 13 Nov 2009 11:42 +0100, \"Matthieu Moy\"\n<Matthieu.Moy@grenoble-inp.fr> wrote:\n\n> See also post-receive-email in git/contrib/hooks/, probably installed\n\nThank you for your suggestions. I've added a new post-receive hook using\nthe code from post-receive-email. The hook is executable and is placed\nin the remote directory. The push is made from my local pc via ssh, but\nafter the push nothing seems to happen: the hook is not executed on the\nserver side. It does not depend from the code inside the hook: even the\nunique \"touch foobar\" command does not work. Where do I have to look?\n\nThanks\n"}]}