{"thread":{"id":"14716","subject":"Adding custom hooks to a bare repository.","startedAt":"2008-07-28T11:04:01Z","lastAt":"2008-07-28T12:40:19Z","messageCount":5,"participants":["Thomas Adam","Johannes Schindelin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"85271","messageId":"18071eea0807280404w3365748cjcd11f536bf5d27eb@mail.gmail.com","threadId":"14716","inReplyTo":null,"subject":"Adding custom hooks to a bare repository.","fromName":"Thomas Adam","fromEmail":"thomas.adam22@gmail.com","sentAt":"2008-07-28T11:04:01Z","receivedAt":"2008-07-28T11:04:01Z","isPatch":false,"sender":{"key":"thomas.adam22@gmail.com","avatar":"https://gravatar.com/avatar/137f9858bc6bfd5b2f743aefd988c81ce0cbd306248889df80e269519cfc8741?d=mp&s=160"},"body":"Hello all,\n\nI'm trying to add in \"post-merge\" as a valid hook file to an already\ncreated --bare repository.  In adding it to the correct place and\nsetting the correct permissions on it (the repository is a shared\none), it doesn't seem to be pulled down with the other hook files\nalready present when doing a \"git clone\".\n\nAny ideas why?\n\nIndeed, I also, as a test, added this post-merge hook to a repository\nand created a --bare repository from that - thinking that perhaps the\nhook file had to present at the time of creating a new repository, but\neven then it wasn't copied over to the bare repository.\n\nWhat am I doing wrong?\n\nThanks in advance,\n\n-- Thomas Adam\n"},{"id":"85276","messageId":"alpine.DEB.1.00.0807281324350.2725@eeepc-johanness","threadId":"14716","inReplyTo":"18071eea0807280404w3365748cjcd11f536bf5d27eb@mail.gmail.com","subject":"Re: Adding custom hooks to a bare repository.","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-07-28T11:26:10Z","receivedAt":"2008-07-28T11:26:10Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 28 Jul 2008, Thomas Adam wrote:\n\n> I'm trying to add in \"post-merge\" as a valid hook file to an already \n> created --bare repository.  In adding it to the correct place and \n> setting the correct permissions on it (the repository is a shared one), \n> it doesn't seem to be pulled down with the other hook files already \n> present when doing a \"git clone\".\n> \n> Any ideas why?\n\nYes.  Hooks, just as the config and reflogs, are supposed to be local \nthings.  Rationale being: it is rude, and also insecure, to install \nsomething that potentially calls other programs without the user saying \nso.\n\nAll you can do is checking in a copy of the hook, and ask your users/check \nin your build system that it is installed.\n\nHth,\nDscho\n"},{"id":"85283","messageId":"18071eea0807280532l69d12e3ehb8377da9d24e035@mail.gmail.com","threadId":"14716","inReplyTo":"alpine.DEB.1.00.0807281324350.2725@eeepc-johanness","subject":"Re: Adding custom hooks to a bare repository.","fromName":"Thomas Adam","fromEmail":"thomas.adam22@gmail.com","sentAt":"2008-07-28T12:32:19Z","receivedAt":"2008-07-28T12:32:19Z","isPatch":false,"sender":{"key":"thomas.adam22@gmail.com","avatar":"https://gravatar.com/avatar/137f9858bc6bfd5b2f743aefd988c81ce0cbd306248889df80e269519cfc8741?d=mp&s=160"},"body":"2008/7/28 Johannes Schindelin <Johannes.Schindelin@gmx.de>:\n> Yes.  Hooks, just as the config and reflogs, are supposed to be local\n> things.  Rationale being: it is rude, and also insecure, to install\n> something that potentially calls other programs without the user saying\n> so.\n\nOh absolutely, I agree with that.\n\n> All you can do is checking in a copy of the hook, and ask your users/check\n> in your build system that it is installed.\n\nHmm -- perhaps I am being unintentionally dense, but I am assuming\nthat when you say \"checking in a copy\" you mean anywhere other than\n.git/hooks/ since that isn't tracked by git.  I have no problem with\nthe rationale you've just described -- but it would be handy to add\nthis post-merge hook script into hooks/ (exec bit removed) such that\non a clone, all one would need to do is chmod +x it.   If that's\npossible, I'm clearly missing the steps to enable this.\n\nThanks,\n\n-- Thomas Adam\n"},{"id":"85287","messageId":"18071eea0807280540x33940fdej1ac4f48f64d05d4a@mail.gmail.com","threadId":"14716","inReplyTo":"alpine.DEB.1.00.0807281438220.2725@eeepc-johanness","subject":"Re: Adding custom hooks to a bare repository.","fromName":"Thomas Adam","fromEmail":"thomas.adam22@gmail.com","sentAt":"2008-07-28T12:40:13Z","receivedAt":"2008-07-28T12:40:13Z","isPatch":false,"sender":{"key":"thomas.adam22@gmail.com","avatar":"https://gravatar.com/avatar/137f9858bc6bfd5b2f743aefd988c81ce0cbd306248889df80e269519cfc8741?d=mp&s=160"},"body":"2008/7/28 Johannes Schindelin <Johannes.Schindelin@gmx.de>:\n> For all those reasons, it is better to just commit an executable script in\n> your <toplevel>/githooks/post-merge and ask your users to copy it to\n> .git/hooks/.\n\nGrand.  Thank you very much.  :)\n\n-- Thomas Adam\n"},{"id":"85285","messageId":"alpine.DEB.1.00.0807281438220.2725@eeepc-johanness","threadId":"14716","inReplyTo":"18071eea0807280532l69d12e3ehb8377da9d24e035@mail.gmail.com","subject":"Re: Adding custom hooks to a bare repository.","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-07-28T12:40:19Z","receivedAt":"2008-07-28T12:40:19Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 28 Jul 2008, Thomas Adam wrote:\n\n> 2008/7/28 Johannes Schindelin <Johannes.Schindelin@gmx.de>:\n>\n> > Yes.  Hooks, just as the config and reflogs, are supposed to be local \n> > things.  Rationale being: it is rude, and also insecure, to install \n> > something that potentially calls other programs without the user \n> > saying so.\n> \n> Oh absolutely, I agree with that.\n> \n> > All you can do is checking in a copy of the hook, and ask your \n> > users/check in your build system that it is installed.\n> \n> Hmm -- perhaps I am being unintentionally dense, but I am assuming\n> that when you say \"checking in a copy\" you mean anywhere other than\n> .git/hooks/ since that isn't tracked by git.  I have no problem with\n> the rationale you've just described -- but it would be handy to add\n> this post-merge hook script into hooks/ (exec bit removed) such that\n> on a clone, all one would need to do is chmod +x it.   If that's\n> possible, I'm clearly missing the steps to enable this.\n\nNo, as you said, anything in .git/ is not meant to be tracked.  Besides, \nif a user would change the executable bit (as advised), Git would always \nshow this file as modified, making the tree permanently dirty (or worse, \nit could be accidentally be committed as executable).\n\nFor all those reasons, it is better to just commit an executable script in \nyour <toplevel>/githooks/post-merge and ask your users to copy it to \n.git/hooks/.\n\nHth,\nDscho\n"}]}