|
228 | 228 | </target>
|
229 | 229 |
|
230 | 230 | <target name="setup:git-hooks" description="Installs git hooks to local .git/hooks directory from version controlled scripts/git-hooks directory.">
|
231 |
| - <echo>Removing ${repo.root}/.git/hooks, if it exists.</echo> |
232 |
| - <!-- Symlink into .git directory. --> |
233 |
| - <delete dir="${repo.root}/.git/hooks" quiet="true" failonerror="false"/> |
234 |
| - <delete file="${repo.root}/.git/hooks" quiet="true" failonerror="false"/> |
235 |
| - <echo>Symlinking ${repo.root}/scripts/git-hooks to ${repo.root}/.git/hooks.</echo> |
236 |
| - <exec dir="${repo.root}/.git" command="ln -snv ../vendor/acquia/blt/scripts/git-hooks hooks" logoutput="true" checkreturn="true" level="${blt.exec_level}" passthru="true"/> |
| 231 | + <exec dir="${repo.root}/.git" command="mkdir -p hooks" logoutput="true" checkreturn="true" level="${blt.exec_level}" passthru="true"/> |
| 232 | + <delete file="${repo.root}/.git/hooks/pre-commit" failonerror="false" quiet="true" verbose="${blt.verbose}"/> |
| 233 | + <delete file="${repo.root}/.git/hooks/commit-msg" failonerror="false" quiet="true" verbose="${blt.verbose}"/> |
| 234 | + |
| 235 | + <if> |
| 236 | + <not><equals arg1="${git.hooks.pre-commit}" arg2="false"/></not> |
| 237 | + <then> |
| 238 | + <echo level="info">Symlinking ${repo.root}/scripts/git-hooks/pre-commit to ${git.hooks.pre-commit}/pre-commit</echo> |
| 239 | + <exec dir="${repo.root}/.git/hooks" command="ln -snv ${git.hooks.pre-commit}/pre-commit pre-commit" logoutput="true" checkreturn="true" level="${blt.exec_level}" passthru="true"/> |
| 240 | + </then> |
| 241 | + </if> |
| 242 | + <if> |
| 243 | + <not><equals arg1="${git.hooks.commit-msg}" arg2="false"/></not> |
| 244 | + <then> |
| 245 | + <echo level="verbose">Symlinking ${repo.root}/scripts/git-hooks/commit-msg to ${git.hooks.pre-commit}/commit-msg</echo> |
| 246 | + <exec dir="${repo.root}/.git/hooks" command="ln -snv ${git.hooks.commit-msg}/commit-msg commit-msg" logoutput="true" checkreturn="true" level="${blt.exec_level}" passthru="true"/> |
| 247 | + </then> |
| 248 | + </if> |
237 | 249 |
|
238 | 250 | <!-- Grant execution permissions. -->
|
239 |
| - <echo>Making git hooks executable.</echo> |
240 |
| - <chmod mode="0755"> |
| 251 | + <echo level="verbose">Making git hooks executable.</echo> |
| 252 | + <chmod mode="0755" verbose="false"> |
241 | 253 | <fileset dir="${blt.root}/scripts/git-hooks">
|
242 | 254 | <exclude name="**/*.sample" />
|
243 | 255 | <exclude name="**/README.md" />
|
|
0 commit comments