{"thread":{"id":"14812","subject":"git svn and the post-receive hook","startedAt":"2008-08-02T16:05:16Z","lastAt":"2008-08-02T20:45:07Z","messageCount":7,"participants":["Pascal Obry","Miklos Vajna","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"85983","messageId":"489485BC.1020607@obry.net","threadId":"14812","inReplyTo":null,"subject":"git svn and the post-receive hook","fromName":"Pascal Obry","fromEmail":"pascal@obry.net","sentAt":"2008-08-02T16:05:16Z","receivedAt":"2008-08-02T16:05:16Z","isPatch":false,"sender":{"key":"pascal@obry.net","avatar":"https://avatars.githubusercontent.com/u/467069?v=4"},"body":"\nAt the moment it seems to me that the post-receive hook is not called \nwhen tracking a remove Subversion repository.\n\nI think it would be nice to call the post-receive hook at the end of:\n\n    $ git svn rebase\n\nWhy I need this?\n\nI'd like to check for example that if a file has been added to the \nremote Subversion repository then it is properly added into a MANIFEST \nfile. I'd also like to check some style rules. This would help to detect \nsome problems when one has no way to add hooks on the Subversion repository.\n\nI have zero experience with Perl so I do not feel like hacking this myself.\n\nWhat do you think?\n\nIs this already possible (I may have missed something)?\n\nThanks,\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":"85995","messageId":"20080802180319.GZ32057@genesis.frugalware.org","threadId":"14812","inReplyTo":"489485BC.1020607@obry.net","subject":"Re: git svn and the post-receive hook","fromName":"Miklos Vajna","fromEmail":"vmiklos@frugalware.org","sentAt":"2008-08-02T18:03:19Z","receivedAt":"2008-08-02T18:03:19Z","isPatch":false,"sender":{"key":"vmiklos@frugalware.org","avatar":"https://gravatar.com/avatar/401c1cbbb3a5d13e650c691a2c71d6fd0b80df1a01bc74d9f1972675dd58f2bd?d=mp&s=160"},"body":"On Sat, Aug 02, 2008 at 06:05:16PM +0200, Pascal Obry <pascal@obry.net> wrote:\n> At the moment it seems to me that the post-receive hook is not called when \n> tracking a remove Subversion repository.\n\nSure. From the \"post-receive\" hook documentation:\n\n\"This hook is invoked by 'git-receive-pack' on the remote repository,\nwhich happens when a 'git-push' is done on a local repository.\"\n\nAnd git svn will never invoke git receive-pack.\n\n> I think it would be nice to call the post-receive hook at the end of:\n> \n>    $ git svn rebase\n\nWhat about a post-rebase hook, like there is a post-merge one?\n\n> I have zero experience with Perl so I do not feel like hacking this myself.\n\ngit rebase is shell. ;-)\n"},{"id":"85999","messageId":"7v8wvfmg4q.fsf@gitster.siamese.dyndns.org","threadId":"14812","inReplyTo":"489485BC.1020607@obry.net","subject":"Re: git svn and the post-receive hook","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-08-02T18:22:13Z","receivedAt":"2008-08-02T18:22:13Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Pascal Obry <pascal@obry.net> writes:\n\n> At the moment it seems to me that the post-receive hook is not called\n> when tracking a remove Subversion repository.\n>\n> I think it would be nice to call the post-receive hook at the end of:\n>\n>    $ git svn rebase\n>\n> Why I need this?\n>\n> I'd like to check ...\n\nWait a minute.\n\nIsn't \"git svn rebase\" an operation that you do on your local repository,\nslurping the update from the other end and then replaying your change on\ntop of it?  If so, I think it falls into the same category as \"post-fetch\"\nhook which would run after you run fetch, if such a thing existed.  See:\n\n    http://thread.gmane.org/gmane.comp.version-control.git/79306/focus=79321\n\nfor the reason why we usually do not add such a hook on the local end.\n"},{"id":"86000","messageId":"7vwsizl0l9.fsf@gitster.siamese.dyndns.org","threadId":"14812","inReplyTo":"489485BC.1020607@obry.net","subject":"Re: git svn and the post-receive hook","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-08-02T18:43:14Z","receivedAt":"2008-08-02T18:43:14Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Pascal Obry <pascal@obry.net> writes:\n\n> I'd like to check for example that if a file has been added to the\n> remote Subversion repository then it is properly added into a MANIFEST\n> file. I'd also like to check some style rules. This would help to\n> detect some problems when one has no way to add hooks on the\n> Subversion repository.\n\nAre you saying that there may be breakages that is made at the Subversion\nside, and you would want to catch it?\n\nWhat would you do _after_ finding out that somebody screwed up and you\nhave a borked history on the Subversion side already?\n\nI do not think this belongs to \"git svn rebase\" (let alone \"git rebase\",\nno way --- you won't rewrite nor reject the upstream even if you find\nproblems with it).\n\nI understand that you would at least want to notice the damange to the\nhistory that happened at the remote end, and I agree it would make sense\nto do something like:\n\n\t$ git command-that-updates-the-remote-tracking-branch git-svn\n        $ check-history git-svn@{1}..git-svn\n\nThe \"command-that-updates\" could be \"svn fetch\" or just a simple \"fetch\".\n\nBut the \"check-history\" script will be very specific to your project, and\nI do not think it makes sense to make it a hook to the \"command-that-updates\".\n"},{"id":"86003","messageId":"4894B387.4040004@obry.net","threadId":"14812","inReplyTo":"7vwsizl0l9.fsf@gitster.siamese.dyndns.org","subject":"Re: git svn and the post-receive hook","fromName":"Pascal Obry","fromEmail":"pascal@obry.net","sentAt":"2008-08-02T19:20:39Z","receivedAt":"2008-08-02T19:20:39Z","isPatch":false,"sender":{"key":"pascal@obry.net","avatar":"https://avatars.githubusercontent.com/u/467069?v=4"},"body":"\nJunio,\n\n> Are you saying that there may be breakages that is made at the Subversion\n> side, and you would want to catch it?\n\nExactly.\n\n> What would you do _after_ finding out that somebody screwed up and you\n> have a borked history on the Subversion side already?\n\nNotify the developer(s) about the problem(s).\n\n> I do not think this belongs to \"git svn rebase\" (let alone \"git rebase\",\n> no way --- you won't rewrite nor reject the upstream even if you find\n> problems with it).\n> \n> I understand that you would at least want to notice the damange to the\n> history that happened at the remote end, and I agree it would make sense\n> to do something like:\n> \n> \t$ git command-that-updates-the-remote-tracking-branch git-svn\n>         $ check-history git-svn@{1}..git-svn\n> \n> The \"command-that-updates\" could be \"svn fetch\" or just a simple \"fetch\".\n> \n> But the \"check-history\" script will be very specific to your project, and\n> I do not think it makes sense to make it a hook to the \"command-that-updates\".\n\nHum... Any hook is very specific to a project. That's why it is a hook \nand not a built-in command.\n\nBTW, I do not see why this would be a problem with git-svn whereas the \npost-receive hook is fine for Git. In many projects rewriting history is \nnot permitted but post-receive is quite handy to do some checks.\n\npost-received receive 3 parameters:\n\n   - sha before\n   - sha after\n   - refname\n\nIt is perfectly usable after a git-svn rebase.\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":"86006","messageId":"7vod4bdvga.fsf@gitster.siamese.dyndns.org","threadId":"14812","inReplyTo":"4894B387.4040004@obry.net","subject":"Re: git svn and the post-receive hook","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-08-02T20:16:05Z","receivedAt":"2008-08-02T20:16:05Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Pascal Obry <pascal@obry.net> writes:\n\n> BTW, I do not see why this would be a problem with git-svn whereas the\n> post-receive hook is fine for Git.\n\nYou probably haven't read Miklos's response have you?  post-receive is\nabout what happens at the remote end after you \"push\" there, and does not\nhave to do with what happens when you fetch.\n\nThe article I gave you a link earlier gives a guideline to decide when we\nchoose to add hook for particular step of operation (and when we choose\nnot to).  The new call from \"git svn rebase\" (and presumably \"git svn\nfetch\" which is the first step of that operation) needs to be justified.\n\nHaving said that, I would have framed your argument in a different way.  I\nsuspect then you would not have heard the above objections if you did so:\n\n   After pushing to a remote side, there is a post-receive hook so that\n   some processing can happen depending on which refs changed from what\n   commit to what new commit.  This is primarily because \"push\" goes to\n   the remote side and the user may not have any other means to trigger an\n   operation over there (e.g. there may not be ssh login access, just\n   git-shell running to accept pushes).\n\n   After fetching from somewhere else, there is no post-fetch hook.  This\n   is not a show-stopper problem because the operation is local.  You can\n   remember where the refs were before running a fetch, run the fetch, and\n   run necessary post-fetch operation.  IOW, instead of \"git fetch\" (or\n   \"git svn fetch\") calling a custom script installed as a hook, a custom\n   script can call \"git fetch\" (or \"git svn fetch\") as part of what it\n   does.\n\n   However, fetch and push are logically the same operation --- update a\n   set of refs on one end to match the other end, while transferring the\n   necessary objects to keep the updated refs valid.  We even suggest\n   (with satellite-mothership configuration) to push into remote when\n   network reachability constraints keeps you from fetching in the other\n   direction or vice versa.  If you used fetch to update refs at the\n   receiving end only because you somehow cannot push in the other\n   direction, it is natural you would want to do the same processing after\n   the fetch that post-receive hook would have done if you could push in\n   the direction you originally wanted to.\n\n   Which suggests that we may be better off having a unified post-sync\n   hook, that would be called with the same arguments as existing\n   post-receive hook is called with, whenever fetch initiated at the local\n   end or a push initiated from elsewhere updates refs in the local\n   repository (such a hook is justified because it needs to _also_ work\n   at the remote side).\n\n   To keep the migration hassle to the minimum, we can reuse post-receive\n   hook itself for that purpose without actually introducing a new\n   post-sync hook.  So how about calling post-receive from \"git fetch\" and\n   \"git svn fetch\"?  This is a change in semantics, and it may break\n   people's existing setups (i.e. they may be relying on post-receive not\n   to trigger when they fetch), so we need to proceed carefully, but I\n   think it is in the right direction.\n\nI actually am more than sympathetic to this cause. I think the unified\npost-sync mechanism is a sensible thing to do, at least in the longer\nterm.\n\nWe might also need to teach push over http (which is not even a second\nclass citizen) to trigger post-receive if it does not already do so.\n"},{"id":"86007","messageId":"20080802204507.GA32057@genesis.frugalware.org","threadId":"14812","inReplyTo":"7vod4bdvga.fsf@gitster.siamese.dyndns.org","subject":"Re: git svn and the post-receive hook","fromName":"Miklos Vajna","fromEmail":"vmiklos@frugalware.org","sentAt":"2008-08-02T20:45:07Z","receivedAt":"2008-08-02T20:45:07Z","isPatch":false,"sender":{"key":"vmiklos@frugalware.org","avatar":"https://gravatar.com/avatar/401c1cbbb3a5d13e650c691a2c71d6fd0b80df1a01bc74d9f1972675dd58f2bd?d=mp&s=160"},"body":"On Sat, Aug 02, 2008 at 01:16:05PM -0700, Junio C Hamano <gitster@pobox.com> wrote:\n> We might also need to teach push over http (which is not even a second\n> class citizen) to trigger post-receive if it does not already do so.\n\nThat would be nice, but as far as I understand that is not possible\nwithout ugly hacks like subversion's mod_svn or a CGI script. Or did you\nrefer to the later?\n"}]}