{"thread":{"id":"30194","subject":"pre-receive/update hook: how to know forced push?","startedAt":"2012-04-10T13:59:17Z","lastAt":"2012-04-10T14:49:23Z","messageCount":2,"participants":["Alexey Shumkin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"188861","messageId":"20120410175917.0942d8f2@ashu.dyn1.rarus.ru","threadId":"30194","inReplyTo":null,"subject":"pre-receive/update hook: how to know forced push?","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2012-04-10T13:59:17Z","receivedAt":"2012-04-10T13:59:17Z","isPatch":false,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"Hi, guys!\n\nHow to know in pre-receive hook that commit has been pushed with\n--force option?\n\nI've written some pre-receive hook that denies pushed commits which have\nauthor's date earlier then current branch HEAD. It's done to prevent\nnot triggering automated builds which are based on authors' timestamps.\n\nBut some time later I had to rollback branch to previous state.\nIt is not convenient way to \"git update-ref ...\" on the server, I'd like\nto git push --force, but there is a question in the first sentence:\n\nHow to know in pre-receive hook that commit has been pushed with\n--force option?\n\nThanx in advance\n"},{"id":"188870","messageId":"20120410184923.7198bf4a@ashu.dyn1.rarus.ru","threadId":"30194","inReplyTo":"20120410175917.0942d8f2@ashu.dyn1.rarus.ru","subject":"Re: pre-receive/update hook: how to know forced push?","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2012-04-10T14:49:23Z","receivedAt":"2012-04-10T14:49:23Z","isPatch":false,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"After some investigation of sources it seems to me \ndecision to push changes to server or not is made by git client,\nso server can only reject pushed updates.\n\nSome examples of necessary detections can be found in\n'contrib/hooks/post-receive-email' hook.\n\nSorry for the noise\n\n> Hi, guys!\n> \n> How to know in pre-receive hook that commit has been pushed with\n> --force option?\n> \n> I've written some pre-receive hook that denies pushed commits which\n> have author's date earlier then current branch HEAD. It's done to\n> prevent not triggering automated builds which are based on authors'\n> timestamps.\n> \n> But some time later I had to rollback branch to previous state.\n> It is not convenient way to \"git update-ref ...\" on the server, I'd\n> like to git push --force, but there is a question in the first\n> sentence:\n> \n> How to know in pre-receive hook that commit has been pushed with\n> --force option?\n> \n> Thanx in advance\n> \n"}]}