{"thread":{"id":"12764","subject":"global hooks","startedAt":"2008-03-19T16:04:31Z","lastAt":"2008-03-20T12:56:16Z","messageCount":6,"participants":["Victor Bogado da Silva Lins","Jonathan del Strother","Junio C Hamano","Johan Herland","Ping Yin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"72430","messageId":"1205942671.691.8.camel@omicron.ep.petrobras.com.br","threadId":"12764","inReplyTo":null,"subject":"global hooks","fromName":"Victor Bogado da Silva Lins","fromEmail":"victor@bogado.net","sentAt":"2008-03-19T16:04:31Z","receivedAt":"2008-03-19T16:04:31Z","isPatch":false,"sender":{"key":"victor@bogado.net","avatar":"https://gravatar.com/avatar/4ad1d046d4c1a5673a65aac199e2113f4e2d2ffe88d095cb3e17c1f20126cfac?d=mp&s=160"},"body":"Hi, I made a prepare-commit-msg hook today, it basically appends the\ndiff I am about to commit to the commented information that normally\nappears. \n\nThe problem is that if I want this hook in all projects I have, I have\nto copy that file to every single project I have. This is an error prone\noperation, not to mention a pain in the... .\n\nSO my question is, is there a way to make that hook global to all\nprojects? If not, would it be a good idea to allow this?\n"},{"id":"72464","messageId":"57518fd10803191804g7b2ce670xe5d89b53c1bb8f6f@mail.gmail.com","threadId":"12764","inReplyTo":"1205942671.691.8.camel@omicron.ep.petrobras.com.br","subject":"Re: global hooks","fromName":"Jonathan del Strother","fromEmail":"maillist@steelskies.com","sentAt":"2008-03-20T01:04:33Z","receivedAt":"2008-03-20T01:04:33Z","isPatch":false,"sender":{"key":"jon.delstrother@bestbefore.tv","avatar":"https://gravatar.com/avatar/754e21ab701c00e2d21fc261187254c34b2a1c0b959d9ee5be1a295990be3081?d=mp&s=160"},"body":"On Wed, Mar 19, 2008 at 4:04 PM, Victor Bogado da Silva Lins\n<victor@bogado.net> wrote:\n> Hi, I made a prepare-commit-msg hook today, it basically appends the\n>  diff I am about to commit to the commented information that normally\n>  appears.\n>\n>  The problem is that if I want this hook in all projects I have, I have\n>  to copy that file to every single project I have. This is an error prone\n>  operation, not to mention a pain in the... .\n>\n>  SO my question is, is there a way to make that hook global to all\n>  projects? If not, would it be a good idea to allow this?\n\nI'd love to see something along these lines - at the moment, I have a\nprecommit hook to drop textmate's caret metadata from the commit file,\nand it's a pain having to symlink it into every git repo.\n"},{"id":"72469","messageId":"7vk5jyyvw1.fsf@gitster.siamese.dyndns.org","threadId":"12764","inReplyTo":"1205942671.691.8.camel@omicron.ep.petrobras.com.br","subject":"Re: global hooks","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-03-20T02:25:18Z","receivedAt":"2008-03-20T02:25:18Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Victor Bogado da Silva Lins <victor@bogado.net> writes:\n\n> SO my question is, is there a way to make that hook global to all\n> projects? If not, would it be a good idea to allow this?\n\nProbably a post- git-init hook that lets you do anything to your newly\ncreated repository would be the only thing that you need.  Then you can\ncopy, untar or even use symlink to muck with .git/hooks/ in whatever way\nyou please.\n\nThere needs a mechanism for you to specify what that hook is, and it\ncannot be in individual repositories, so it has to live in ~/.gitconfig\nsomewhere.\n"},{"id":"72506","messageId":"200803201220.47503.johan@herland.net","threadId":"12764","inReplyTo":"7vk5jyyvw1.fsf@gitster.siamese.dyndns.org","subject":"Re: global hooks","fromName":"Johan Herland","fromEmail":"johan@herland.net","sentAt":"2008-03-20T11:20:47Z","receivedAt":"2008-03-20T11:20:47Z","isPatch":false,"sender":{"key":"johan@herland.net","avatar":"https://avatars.githubusercontent.com/u/547031?v=4"},"body":"On Thursday 20 March 2008, Junio C Hamano wrote:\n> Victor Bogado da Silva Lins <victor@bogado.net> writes:\n> \n> > SO my question is, is there a way to make that hook global to all\n> > projects? If not, would it be a good idea to allow this?\n> \n> Probably a post- git-init hook that lets you do anything to your newly\n> created repository would be the only thing that you need.  Then you can\n> copy, untar or even use symlink to muck with .git/hooks/ in whatever way\n> you please.\n> \n> There needs a mechanism for you to specify what that hook is, and it\n> cannot be in individual repositories, so it has to live in ~/.gitconfig\n> somewhere.\n\nOr you could add the hook (either the post-init hook, or for that matter\nthe hook you want to make global) to the Git template directory on your\nsystem (/usr/share/git-core/templates by default). If you don't want to\nmake it system-global (only user-global), I guess you could make your\nown Git template directory somewhere (copy the system's template dir,\nand add/enable whatever hooks you like), and set up an alias to\n\"git init --template=<your_template_dir>\". Then use this alias instead\nof \"git init\".\n\n\n...Johan\n\n-- \nJohan Herland, <johan@herland.net>\nwww.herland.net\n"},{"id":"72507","messageId":"46dff0320803200526x7b2a535fu25bae005348bb8e6@mail.gmail.com","threadId":"12764","inReplyTo":"200803201220.47503.johan@herland.net","subject":"Re: global hooks","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-03-20T12:26:32Z","receivedAt":"2008-03-20T12:26:32Z","isPatch":false,"sender":{"key":"pkufranky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5346?v=4"},"body":"On Thu, Mar 20, 2008 at 7:20 PM, Johan Herland <johan@herland.net> wrote:\n> On Thursday 20 March 2008, Junio C Hamano wrote:\n>  > Victor Bogado da Silva Lins <victor@bogado.net> writes:\n>  >\n>  > > SO my question is, is there a way to make that hook global to all\n>  > > projects? If not, would it be a good idea to allow this?\n>  >\n>  > Probably a post- git-init hook that lets you do anything to your newly\n>  > created repository would be the only thing that you need.  Then you can\n>  > copy, untar or even use symlink to muck with .git/hooks/ in whatever way\n>  > you please.\n>  >\n>  > There needs a mechanism for you to specify what that hook is, and it\n>  > cannot be in individual repositories, so it has to live in ~/.gitconfig\n>  > somewhere.\n>\n>  Or you could add the hook (either the post-init hook, or for that matter\n>  the hook you want to make global) to the Git template directory on your\n>  system (/usr/share/git-core/templates by default). If you don't want to\n>  make it system-global (only user-global), I guess you could make your\n>  own Git template directory somewhere (copy the system's template dir,\n>  and add/enable whatever hooks you like), and set up an alias to\n>  \"git init --template=<your_template_dir>\". Then use this alias instead\n>  of \"git init\".\n>\n\ntemplate dir is meaningful for static hooks. However, sometimes we\nneed dynamic hooks which change over time. Having a real global hook\ncan help to implement a single logic or policy spreading among\nmultiple repositories.\n\nFor example, we can enfore a policy to help to update the test or\ndeploy environent automatically: when repositories are pushed into a\ncentral place, they are checked out into different places or hosts\nautomatically.\n\nI think ~/.gitconfig is a good place to give such an entry point.\n\n\n\n-- \nPing Yin\n"},{"id":"72509","messageId":"200803201356.16512.johan@herland.net","threadId":"12764","inReplyTo":"46dff0320803200526x7b2a535fu25bae005348bb8e6@mail.gmail.com","subject":"Re: global hooks","fromName":"Johan Herland","fromEmail":"johan@herland.net","sentAt":"2008-03-20T12:56:16Z","receivedAt":"2008-03-20T12:56:16Z","isPatch":false,"sender":{"key":"johan@herland.net","avatar":"https://avatars.githubusercontent.com/u/547031?v=4"},"body":"On Thursday 20 March 2008, Ping Yin wrote:\n> On Thu, Mar 20, 2008 at 7:20 PM, Johan Herland <johan@herland.net> wrote:\n> > On Thursday 20 March 2008, Junio C Hamano wrote:\n> >  > Victor Bogado da Silva Lins <victor@bogado.net> writes:\n> >  > > SO my question is, is there a way to make that hook global to all\n> >  > > projects? If not, would it be a good idea to allow this?\n> >  >\n> >  > Probably a post- git-init hook that lets you do anything to your newly\n> >  > created repository would be the only thing that you need.  Then you can\n> >  > copy, untar or even use symlink to muck with .git/hooks/ in whatever way\n> >  > you please.\n> >  >\n> >  > There needs a mechanism for you to specify what that hook is, and it\n> >  > cannot be in individual repositories, so it has to live in ~/.gitconfig\n> >  > somewhere.\n> >\n> >  Or you could add the hook (either the post-init hook, or for that matter\n> >  the hook you want to make global) to the Git template directory on your\n> >  system (/usr/share/git-core/templates by default). If you don't want to\n> >  make it system-global (only user-global), I guess you could make your\n> >  own Git template directory somewhere (copy the system's template dir,\n> >  and add/enable whatever hooks you like), and set up an alias to\n> >  \"git init --template=<your_template_dir>\". Then use this alias instead\n> >  of \"git init\".\n> \n> template dir is meaningful for static hooks. However, sometimes we\n> need dynamic hooks which change over time. Having a real global hook\n> can help to implement a single logic or policy spreading among\n> multiple repositories.\n\nIf you need to centralize the logic, you can just keep the actual hook\noutside the template directory, and store an (absolute) symlink within\nthe template dir pointing to the hook. All your git repos will now\nexercise the centralized hook instead of each having a separate copy.\n\n> For example, we can enfore a policy to help to update the test or\n> deploy environent automatically: when repositories are pushed into a\n> central place, they are checked out into different places or hosts\n> automatically.\n> \n> I think ~/.gitconfig is a good place to give such an entry point.\n\nStill, I think this can be solved with the existing tools, without\nadding more features and config directives.\n\n\n...Johan\n\n-- \nJohan Herland, <johan@herland.net>\nwww.herland.net\n"}]}