Hi im trying to create a pre-commit hook so what when a user commits code, it is checked for a jira association.
I only want it to apply to a specific project, how do i do this?
I have a structure like: (no hooks folder in the base or any projects)
//subversion.xxxx.net/svn/dev
->/com/text/project1
->/com/text2/project2
1) I want my pre-commit hook to apply to project1 only, where do I place the script? is it in /com/text/project1/hooks?
or am i wrong and i need to create folder in //subversion.xxxx.net/svn/dev/hooks?
2) for global project commits do i place it //subversion.xxxx.net/svn/dev/hooks?
Any help woudl be good, i just dont want to add it, as everyone is suing it at the moment.
First (and I realize this isn’t the thrust of your question), you want to look into the JIRA Commit Acceptance plugin. It does exactly what you want, including the pre-commit hoook – no need to reinvent the wheel.
To your question, I like where you’re going – you definitely want your hooks in version control. You don’t need the hook stored in the repo that uses it. Since it’s only used on the server, there is no need for the team to have to check it out.
I’d recommend you make a new repository for hooks (called hooks). I do this and have a checkout of this repo on the server, then
SUBVERSION_REPOSITORY_HOME/hooks/pre-commit.shcalls the scripts in my checkout of hooks. It’s nice, as a change can be applied to all repos simply by checking it in and then doing an svn up on the server.