{"thread":{"id":"29763","subject":"Bug: post-receive-email sometimes misses commits","startedAt":"2012-02-27T20:39:37Z","lastAt":"2012-02-27T20:43:02Z","messageCount":2,"participants":["Michael Haggerty"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"185557","messageId":"4F4BEA09.90600@alum.mit.edu","threadId":"29763","inReplyTo":null,"subject":"Bug: post-receive-email sometimes misses commits","fromName":"Michael Haggerty","fromEmail":"mhagger@alum.mit.edu","sentAt":"2012-02-27T20:39:37Z","receivedAt":"2012-02-27T20:39:37Z","isPatch":false,"sender":{"key":"mhagger@alum.mit.edu","avatar":"https://avatars.githubusercontent.com/u/119718?v=4"},"body":"In the following scenario, suppose that commit X is already in the\nrepository (referenced by master), and I push references A and B at the\nsame time:\n\n\n       -- master\n     /\no---X---*'--*'--*   A\n             \\\n              *---*   B\n\nThe commits marked with \"*\" are new to the repository, and therefore the\nemails generated by post-receive-email should summarize all five of\nthem.  But in fact the commits marked with a prime (i.e., A^ and A^^)\nare NOT included in any email.\n\nThe problem is that post-receive-email operates on one reference update\nat a time, *after* the references have been updated.  It generates the\n\"new\" commits for A using the equivalent of\n\n    git rev-list ^master ^B A\n\nand it generates the \"new\" commits for B using the equivalent of\n\n    git rev-list ^master ^B A\n\nNeither of these ranges includes the commits common to branches A and B\nand therefore those commits do not appear in any of the email notifications.\n\nI first observed this problem in a slightly more complicated scenario\nwhere a bugfix branch was merged to two release branches, then the two\nrelease branches (but not the bugfix reference) were pushed:\n\n          o---o-------* release-A\n         /           /\no---o---o---*'--*'--*' bugfix\n         \\           \\\n          o---o-------* release-B\n\nIn this case only the merge commits were included in the commit emails;\nthe bugfixes commits themselves were never mentioned.\n\nIt seems like this problem can only be fixed by having\npost-receive-email process all of the reference updates at once so that\nthe email generation for one reference update can take into account the\nother references that were updated at the same time.\n\nI don't plan to work on this problem; locally, we are using a Python\nscript that was derived from post-receive-email and enhanced in several\nways rather than using the Shell-script original.  So when I have fixed\nour Python script my own itch will have been scratched.  If there is\ninterest in the Python email-notification script please let me know and\nthere is a chance I might clean it up enough to be released.\n\nMichael\n\n-- \nMichael Haggerty\nmhagger@alum.mit.edu\nhttp://softwareswirl.blogspot.com/\n"},{"id":"185558","messageId":"4F4BEAD6.9040109@alum.mit.edu","threadId":"29763","inReplyTo":"4F4BEA09.90600@alum.mit.edu","subject":"Re: Bug: post-receive-email sometimes misses commits","fromName":"Michael Haggerty","fromEmail":"mhagger@alum.mit.edu","sentAt":"2012-02-27T20:43:02Z","receivedAt":"2012-02-27T20:43:02Z","isPatch":false,"sender":{"key":"mhagger@alum.mit.edu","avatar":"https://avatars.githubusercontent.com/u/119718?v=4"},"body":"On 02/27/2012 09:39 PM, Michael Haggerty wrote:\n> [...]  It generates the\n> \"new\" commits for A using the equivalent of\n> \n>     git rev-list ^master ^B A\n> \n> and it generates the \"new\" commits for B using the equivalent of\n> \n>     git rev-list ^master ^B A\n\nSorry, that last line should of course be\n\n    git rev-list ^master ^A B\n\nMichael\n\n-- \nMichael Haggerty\nmhagger@alum.mit.edu\nhttp://softwareswirl.blogspot.com/\n"}]}