{"thread":{"id":"25341","subject":"Git version of some common SVN hooks?","startedAt":"2010-10-04T19:43:45Z","lastAt":"2010-10-04T20:58:24Z","messageCount":2,"participants":["Dun Peal","Chris Packham"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"152582","messageId":"AANLkTimPGtH9xCh8rLSMAa2KDNOEDUt49qFK7p==aZho@mail.gmail.com","threadId":"25341","inReplyTo":null,"subject":"Git version of some common SVN hooks?","fromName":"Dun Peal","fromEmail":"dunpealer@gmail.com","sentAt":"2010-10-04T19:43:45Z","receivedAt":"2010-10-04T19:43:45Z","isPatch":false,"sender":{"key":"dunpealer@gmail.com","avatar":"https://gravatar.com/avatar/42f3e6a1166eb44e33f24c20ccbe809fa8591413f366dfe3755c8a8d4935ace9?d=mp&s=160"},"body":"Hi,\n\nI'm porting a large and active repository from SVN to Git.\n\nTo provide the developers with the same features, I need the Git\nversion of the following common hooks:\n\n1. svn2cl: the Subversion ChangeLog Generator. Basically a script that\nsends a readable email listing a range of commits, showing just a\nshort summary for each commit: author name, timestamp, hash, paths\nmodified, commit message.\n2. Hook to reject any commit containing a path with non-ASCII characters.\n3. Hook to reject any commit causing the repository to contain two or\nmore paths that differ from each other only in letter case. For\ninstance, a commit adding foo/bar.py would be rejected if foo/Bar.py\nwas added as part of that same commit, or already existed in the repo.\n4. Hook to trigger an action based on which path was committed to. For\nexample, if a developer commits into REPO_ROOT/foo, send an email to\naddress foo@somedomain, whereas a commit to REPO_ROOT/bar will send an\nemail to bar@somedomain.\n\nI'm hoping there are Git versions of these hooks already written, but\nif now any leads about implementing them would be appreciated.\n\nOur full setup btw is a large repository hosted on a local instance of\nGitorious. All our users use Git >= 1.7, although they work on all 3\noperating systems: Linux, OS X, Windows.\n\nThanks, D\n"},{"id":"152593","messageId":"4CAA3FF0.2040404@gmail.com","threadId":"25341","inReplyTo":"AANLkTimPGtH9xCh8rLSMAa2KDNOEDUt49qFK7p==aZho@mail.gmail.com","subject":"Re: Git version of some common SVN hooks?","fromName":"Chris Packham","fromEmail":"judge.packham@gmail.com","sentAt":"2010-10-04T20:58:24Z","receivedAt":"2010-10-04T20:58:24Z","isPatch":false,"sender":{"key":"judge.packham@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155667?v=4"},"body":"On 04/10/10 12:43, Dun Peal wrote:\n> Hi,\n> \n> I'm porting a large and active repository from SVN to Git.\n> \n> To provide the developers with the same features, I need the Git\n> version of the following common hooks:\n> \n> 1. svn2cl: the Subversion ChangeLog Generator. Basically a script that\n> sends a readable email listing a range of commits, showing just a\n> short summary for each commit: author name, timestamp, hash, paths\n> modified, commit message.\n> 2. Hook to reject any commit containing a path with non-ASCII characters.\n> 3. Hook to reject any commit causing the repository to contain two or\n> more paths that differ from each other only in letter case. For\n> instance, a commit adding foo/bar.py would be rejected if foo/Bar.py\n> was added as part of that same commit, or already existed in the repo.\n> 4. Hook to trigger an action based on which path was committed to. For\n> example, if a developer commits into REPO_ROOT/foo, send an email to\n> address foo@somedomain, whereas a commit to REPO_ROOT/bar will send an\n> email to bar@somedomain.\n> \n> I'm hoping there are Git versions of these hooks already written, but\n> if now any leads about implementing them would be appreciated.\n> \n> Our full setup btw is a large repository hosted on a local instance of\n> Gitorious. All our users use Git >= 1.7, although they work on all 3\n> operating systems: Linux, OS X, Windows.\n> \n> Thanks, D\n\nI don't know if they suit all of your needs but there are a few default\nhooks that ship with git. Have a look at .git/hooks/*.sample in any\ninit-ed git repository. You can also find them here\nhttp://repo.or.cz/w/git.git/tree/HEAD:/templates\n\nThere are also some in http://repo.or.cz/w/git.git/tree/HEAD:/contrib/hooks\n\nThere are plenty of others but that's the extent of the googling I'm\ngoing to do for you.\n\nPre-empting your next question. One point to note is that for security\nreasons the hooks don't get included when you clone a repository. This\nis OK for most people as you generally want these things on the server\ncontaining the canonical repository anyway, what other people do with\ntheir clones is up to them.\n\nAt $dayjob we have a few hooks enforcing coding/commit policy so we\nwrote a simple script that can either wrap git clone or be run after git\nclone to install the hooks for individual developers.\n"}]}