From 9b1913e564fdfaf3f1ce8533169fb1b6ad952089 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andor=20D=C3=A1vid?= Date: Thu, 7 Jul 2016 19:19:40 +0200 Subject: [PATCH 1/2] Rename the project from "git-hooks-robo" to "git-hooks" --- .gitignore | 4 ++-- README.md | 12 ++++++------ RoboFile.php | 2 +- fixtures/git-template/config | 4 ++-- fixtures/project-template/basic/composer.json | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index b807b8a..71a2baf 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,5 @@ /release/ /vendor/ -/cheppers-git-hooks-robo-*.tar -/cheppers-git-hooks-robo-*.zip +/cheppers-git-hooks-*.tar +/cheppers-git-hooks-*.zip diff --git a/README.md b/README.md index 08af71f..027fa53 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ -# Trigger Robo tasks from Git hooks +# Trigger custom scripts from Git hooks This package provides a bridge between the un-versioned `.git/hooks/*` scripts and scripts in your Git repository. -[![Build Status](https://travis-ci.org/Cheppers/git-hooks-robo.svg?branch=master)](https://travis-ci.org/Cheppers/git-hooks-robo) -[![Total Downloads](https://poser.pugx.org/cheppers/git-hooks-robo/downloads.png)](https://packagist.org/packages/cheppers/git-hooks-robo) +[![Build Status](https://travis-ci.org/Cheppers/git-hooks.svg?branch=master)](https://travis-ci.org/Cheppers/git-hooks) +[![Total Downloads](https://poser.pugx.org/cheppers/git-hooks/downloads.png)](https://packagist.org/packages/cheppers/git-hooks) ## When to use @@ -43,16 +43,16 @@ teammates then this is the tool you are looking for. { "type": "package", "package": { - "name": "cheppers/git-hooks-robo", + "name": "cheppers/git-hooks", "version": "0.0.5", "type": "git-hook", "dist": { "type": "tar", - "url": "https://github.com/Cheppers/git-hooks-robo/releases/download/v0.0.5/v0.0.5.tar.gz" + "url": "https://github.com/Cheppers/git-hooks/releases/download/v0.0.5/v0.0.5.tar.gz" }, "source": { "type": "git", - "url": "https://github.com/Cheppers/git-hooks-robo.git", + "url": "https://github.com/Cheppers/git-hooks.git", "reference": "v0.0.5" } } diff --git a/RoboFile.php b/RoboFile.php index c2e1455..50db54b 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -1,7 +1,7 @@ Date: Thu, 7 Jul 2016 20:19:19 +0200 Subject: [PATCH 2/2] Move hooks --- RoboFile.php | 47 ++++++++++++--------------- applypatch-msg | 25 -------------- commit-msg | 26 --------------- composer.json | 37 +++++++++++---------- features/bootstrap/FeatureContext.php | 45 ++++++++++++------------- pre-auto-gc => hooks/_common | 8 ----- hooks/applypatch-msg | 7 ++++ hooks/commit-msg | 7 ++++ hooks/post-applypatch | 7 ++++ hooks/post-checkout | 7 ++++ hooks/post-commit | 7 ++++ hooks/post-merge | 7 ++++ hooks/post-receive | 7 ++++ hooks/post-rewrite | 7 ++++ hooks/post-update | 7 ++++ hooks/pre-applypatch | 7 ++++ hooks/pre-auto-gc | 7 ++++ hooks/pre-commit | 6 ++++ hooks/pre-push | 7 ++++ hooks/pre-rebase | 7 ++++ hooks/pre-receive | 7 ++++ hooks/prepare-commit-msg | 7 ++++ hooks/push-to-checkout | 7 ++++ hooks/update | 7 ++++ post-applypatch | 27 --------------- post-checkout | 37 --------------------- post-commit | 27 --------------- post-merge | 32 ------------------ post-receive | 23 ------------- post-rewrite | 21 ------------ post-update | 22 ------------- pre-applypatch | 24 -------------- pre-commit | 24 -------------- pre-push | 28 ---------------- pre-rebase | 25 -------------- pre-receive | 44 ------------------------- prepare-commit-msg | 26 --------------- push-to-checkout | 22 ------------- update | 25 -------------- 39 files changed, 187 insertions(+), 533 deletions(-) delete mode 100644 applypatch-msg delete mode 100644 commit-msg rename pre-auto-gc => hooks/_common (68%) create mode 100644 hooks/applypatch-msg create mode 100644 hooks/commit-msg create mode 100644 hooks/post-applypatch create mode 100644 hooks/post-checkout create mode 100644 hooks/post-commit create mode 100644 hooks/post-merge create mode 100644 hooks/post-receive create mode 100644 hooks/post-rewrite create mode 100644 hooks/post-update create mode 100644 hooks/pre-applypatch create mode 100644 hooks/pre-auto-gc create mode 100644 hooks/pre-commit create mode 100644 hooks/pre-push create mode 100644 hooks/pre-rebase create mode 100644 hooks/pre-receive create mode 100644 hooks/prepare-commit-msg create mode 100644 hooks/push-to-checkout create mode 100644 hooks/update delete mode 100644 post-applypatch delete mode 100644 post-checkout delete mode 100644 post-commit delete mode 100644 post-merge delete mode 100644 post-receive delete mode 100644 post-rewrite delete mode 100644 post-update delete mode 100644 pre-applypatch delete mode 100644 pre-commit delete mode 100644 pre-push delete mode 100644 pre-rebase delete mode 100644 pre-receive delete mode 100644 prepare-commit-msg delete mode 100644 push-to-checkout delete mode 100644 update diff --git a/RoboFile.php b/RoboFile.php index 50db54b..a98834b 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -41,6 +41,7 @@ class RoboFile extends Tasks * @var string[] */ protected $filesToDeploy = [ + '_common' => ['base_mask' => 0666], 'applypatch-msg' => ['base_mask' => 0777], 'commit-msg' => ['base_mask' => 0777], 'post-applypatch' => ['base_mask' => 0777], @@ -91,41 +92,33 @@ public function releaseCreate($version) /** @var \Robo\Collection\Collection $collection */ $collection = $this->collection(); - $collection->add($this - ->taskFilesystemStack() - ->remove('release')); + $name = "{$this->packageVendor}-{$this->packageName}-{$version}"; - $cmd = sprintf( - 'composer archive --format=%s --dir=%s --file=%s', - escapeshellarg('zip'), - escapeshellarg('release'), - escapeshellarg("v{$version}") - ); - $collection->add($this->taskExec($cmd)); + $fs_stack = $this->taskFilesystemStack(); + $collection->add($fs_stack); - $collection->add($this - ->taskExtract("release/v{$version}.zip") - ->to("release/{$this->packageName}-{$version}")); + $fs_stack + ->remove("release/$name") + ->remove("release/$name.tar.gz"); - $collection->add($this - ->taskFilesystemStack() - ->remove("release/v{$version}.zip")); - - $fs_stack_chmod = $this->taskFilesystemStack(); foreach ($this->filesToDeploy as $file_name => $file_meta) { - $fs_stack_chmod->chmod( - "release/{$this->packageName}-{$version}/$file_name", + $fs_stack->copy( + "hooks/$file_name", + "release/$name/$file_name" + ); + + $fs_stack->chmod( + "release/$name/$file_name", $file_meta['base_mask'], 0022 ); } - $collection->add($fs_stack_chmod); - foreach (['tar.gz', 'zip'] as $extension) { - $collection->add($this - ->taskPack("release/{$this->packageVendor}-{$this->packageName}-{$version}.$extension") - ->addDir("{$this->packageName}-{$version}", "release/{$this->packageName}-{$version}")); - } + $collection->add( + $this + ->taskPack("release/$name.tar.gz") + ->addDir($name, "release/$name") + ); $collection->run(); } @@ -243,7 +236,7 @@ protected function getTaskDeployGitHooks() $git_dir = preg_replace('@^' . preg_quote("$current_dir/", '@') . '@', './', $git_dir); foreach ($this->filesToDeploy as $file_name => $file_meta) { $dst = "$git_dir/hooks/$file_name"; - $fsStack->copy($file_name, $dst); + $fsStack->copy("hooks/$file_name", $dst); $fsStack->chmod($dst, $file_meta['base_mask'], umask()); } diff --git a/applypatch-msg b/applypatch-msg deleted file mode 100644 index 2014441..0000000 --- a/applypatch-msg +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env bash -## -# The hook should exit with non-zero status after issuing an appropriate message -# if it wants to stop the commit. -# The hook is allowed to edit the commit message file. -# -# This hook is called with the following parameters: -# No parameters. -# -# Standard input format: -# NULL -## - -hasInput='true' -if [ "$(git rev-parse --is-bare-repository)" = 'true' ]; then - gitHooksBridge='./.git-hooks' -else - gitHooksBridge="$(git rev-parse --show-toplevel)/.git-hooks" -fi - -if [ -s "${gitHooksBridge}" ]; then - . "${gitHooksBridge}" || exit $? -fi - -exit 0 diff --git a/commit-msg b/commit-msg deleted file mode 100644 index ace5d33..0000000 --- a/commit-msg +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash -## -# The hook should exit with non-zero status after issuing an appropriate message -# if it wants to stop the commit. -# -# The hook is allowed to edit the commit message file. -# -# This hook is called with the following parameters: -# - $1 The name of the file that has the commit message. -# -# Standard input format: -# NULL -## - -hasInput='true' -if [ "$(git rev-parse --is-bare-repository)" = 'true' ]; then - gitHooksBridge='./.git-hooks' -else - gitHooksBridge="$(git rev-parse --show-toplevel)/.git-hooks" -fi - -if [ -s "${gitHooksBridge}" ]; then - . "${gitHooksBridge}" || exit $? -fi - -exit 0 diff --git a/composer.json b/composer.json index 77786eb..61eefb5 100644 --- a/composer.json +++ b/composer.json @@ -19,25 +19,26 @@ "exclude": [ "/*", "/.*", + "!/hooks/_common", + "!/hooks/applypatch-msg", + "!/hooks/commit-msg", + "!/hooks/post-applypatch", + "!/hooks/post-checkout", + "!/hooks/post-commit", + "!/hooks/post-merge", + "!/hooks/post-receive", + "!/hooks/post-rewrite", + "!/hooks/post-update", + "!/hooks/pre-applypatch", + "!/hooks/pre-auto-gc", + "!/hooks/pre-commit", + "!/hooks/pre-push", + "!/hooks/pre-rebase", + "!/hooks/pre-receive", + "!/hooks/prepare-commit-msg", + "!/hooks/push-to-checkout", + "!/hooks/update", "!/composer.json", - "!/applypatch-msg", - "!/commit-msg", - "!/post-applypatch", - "!/post-checkout", - "!/post-commit", - "!/post-merge", - "!/post-receive", - "!/post-rewrite", - "!/post-update", - "!/pre-applypatch", - "!/pre-auto-gc", - "!/pre-commit", - "!/pre-push", - "!/pre-rebase", - "!/pre-receive", - "!/prepare-commit-msg", - "!/push-to-checkout", - "!/update", "!/README.md" ] }, diff --git a/features/bootstrap/FeatureContext.php b/features/bootstrap/FeatureContext.php index ca0df1c..8f737ad 100644 --- a/features/bootstrap/FeatureContext.php +++ b/features/bootstrap/FeatureContext.php @@ -51,24 +51,25 @@ class FeatureContext extends \PHPUnit_Framework_Assert implements Context * @var string[] */ protected static $gitHooks = [ - 'applypatch-msg' => 0777, - 'commit-msg' => 0777, - 'post-applypatch' => 0777, - 'post-checkout' => 0777, - 'post-commit' => 0777, - 'post-merge' => 0777, - 'post-receive' => 0666, - 'post-rewrite' => 0666, - 'post-update' => 0777, - 'pre-applypatch' => 0777, - 'pre-auto-gc' => 0777, - 'pre-commit' => 0777, - 'pre-push' => 0777, - 'pre-rebase' => 0777, - 'pre-receive' => 0666, - 'prepare-commit-msg' => 0777, - 'push-to-checkout' => 0777, - 'update' => 0777, + '_common' => ['base_mask' => 0666], + 'applypatch-msg' => ['base_mask' => 0777], + 'commit-msg' => ['base_mask' => 0777], + 'post-applypatch' => ['base_mask' => 0777], + 'post-checkout' => ['base_mask' => 0777], + 'post-commit' => ['base_mask' => 0777], + 'post-merge' => ['base_mask' => 0777], + 'post-receive' => ['base_mask' => 0666], + 'post-rewrite' => ['base_mask' => 0666], + 'post-update' => ['base_mask' => 0777], + 'pre-applypatch' => ['base_mask' => 0777], + 'pre-auto-gc' => ['base_mask' => 0777], + 'pre-commit' => ['base_mask' => 0777], + 'pre-push' => ['base_mask' => 0777], + 'pre-rebase' => ['base_mask' => 0777], + 'pre-receive' => ['base_mask' => 0666], + 'prepare-commit-msg' => ['base_mask' => 0777], + 'push-to-checkout' => ['base_mask' => 0777], + 'update' => ['base_mask' => 0777], ]; /** @@ -119,11 +120,11 @@ protected static function initGitTemplate() static::$fs->mkdir($dir); $mask = umask(); - foreach (static::$gitHooks as $file => $mode) { - $src = static::$projectRootDir . "/$file"; - $dst = "$git_template_dir/hooks/$file"; + foreach (static::$gitHooks as $file_name => $info) { + $src = static::$projectRootDir . "/hooks/$file_name"; + $dst = "$git_template_dir/hooks/$file_name"; static::$fs->copy($src, $dst, true); - static::$fs->chmod($dst, $mode, $mask); + static::$fs->chmod($dst, $info['base_mask'], $mask); } } diff --git a/pre-auto-gc b/hooks/_common similarity index 68% rename from pre-auto-gc rename to hooks/_common index ddb712f..c983794 100644 --- a/pre-auto-gc +++ b/hooks/_common @@ -1,13 +1,5 @@ #!/usr/bin/env bash -## -# The hook is called with the following parameters: -# No parameters. -# -# Standard input format: -# NULL -## -hasInput='true' if [ "$(git rev-parse --is-bare-repository)" = 'true' ]; then gitHooksBridge='./.git-hooks' else diff --git a/hooks/applypatch-msg b/hooks/applypatch-msg new file mode 100644 index 0000000..d5de4e4 --- /dev/null +++ b/hooks/applypatch-msg @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +## +# @see https://git-scm.com/docs/githooks#_applypatch_msg +## + +hasInput='true' +. "$(dirname $0)/_common" diff --git a/hooks/commit-msg b/hooks/commit-msg new file mode 100644 index 0000000..d87863f --- /dev/null +++ b/hooks/commit-msg @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +## +# @see https://git-scm.com/docs/githooks#_commit_msg +## + +hasInput='true' +. "$(dirname $0)/_common" diff --git a/hooks/post-applypatch b/hooks/post-applypatch new file mode 100644 index 0000000..9d89c4d --- /dev/null +++ b/hooks/post-applypatch @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +## +# @see https://git-scm.com/docs/githooks#_post_applypatch +## + +hasInput='true' +. "$(dirname $0)/_common" diff --git a/hooks/post-checkout b/hooks/post-checkout new file mode 100644 index 0000000..8273f1d --- /dev/null +++ b/hooks/post-checkout @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +## +# @see https://git-scm.com/docs/githooks#_post_checkout +## + +hasInput='true' +. "$(dirname $0)/_common" diff --git a/hooks/post-commit b/hooks/post-commit new file mode 100644 index 0000000..9d5eabe --- /dev/null +++ b/hooks/post-commit @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +## +# @see https://git-scm.com/docs/githooks#_post_commit +## + +hasInput='true' +. "$(dirname $0)/_common" diff --git a/hooks/post-merge b/hooks/post-merge new file mode 100644 index 0000000..d4cab5b --- /dev/null +++ b/hooks/post-merge @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +## +# @see https://git-scm.com/docs/githooks#_post_merge +## + +hasInput='true' +. "$(dirname $0)/_common" diff --git a/hooks/post-receive b/hooks/post-receive new file mode 100644 index 0000000..aecbae6 --- /dev/null +++ b/hooks/post-receive @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +## +# @see https://git-scm.com/docs/githooks#post-receive +## + +hasInput='true' +. "$(dirname $0)/_common" diff --git a/hooks/post-rewrite b/hooks/post-rewrite new file mode 100644 index 0000000..36b8b28 --- /dev/null +++ b/hooks/post-rewrite @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +## +# @see https://git-scm.com/docs/githooks#_post_rewrite +## + +hasInput='true' +. "$(dirname $0)/_common" diff --git a/hooks/post-update b/hooks/post-update new file mode 100644 index 0000000..fe66b23 --- /dev/null +++ b/hooks/post-update @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +## +# @see https://git-scm.com/docs/githooks#post-update +## + +hasInput='true' +. "$(dirname $0)/_common" diff --git a/hooks/pre-applypatch b/hooks/pre-applypatch new file mode 100644 index 0000000..d3cd424 --- /dev/null +++ b/hooks/pre-applypatch @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +## +# @see https://git-scm.com/docs/githooks#_pre_applypatch +## + +hasInput='true' +. "$(dirname $0)/_common" diff --git a/hooks/pre-auto-gc b/hooks/pre-auto-gc new file mode 100644 index 0000000..f638d13 --- /dev/null +++ b/hooks/pre-auto-gc @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +## +# @see https://git-scm.com/docs/githooks#_pre_auto_gc +## + +hasInput='true' +. "$(dirname $0)/_common" diff --git a/hooks/pre-commit b/hooks/pre-commit new file mode 100644 index 0000000..ca66245 --- /dev/null +++ b/hooks/pre-commit @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +## +# @see https://git-scm.com/docs/githooks#_pre_commit +## + +. "$(dirname $0)/_common" diff --git a/hooks/pre-push b/hooks/pre-push new file mode 100644 index 0000000..125be7d --- /dev/null +++ b/hooks/pre-push @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +## +# @see https://git-scm.com/docs/githooks#_pre_push +## + +hasInput='true' +. "$(dirname $0)/_common" diff --git a/hooks/pre-rebase b/hooks/pre-rebase new file mode 100644 index 0000000..ed2105f --- /dev/null +++ b/hooks/pre-rebase @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +## +# @see https://git-scm.com/docs/githooks#_pre_rebase +## + +hasInput='true' +. "$(dirname $0)/_common" diff --git a/hooks/pre-receive b/hooks/pre-receive new file mode 100644 index 0000000..d911425 --- /dev/null +++ b/hooks/pre-receive @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +## +# @see https://git-scm.com/docs/githooks#pre-receive +## + +hasInput='true' +. "$(dirname $0)/_common" diff --git a/hooks/prepare-commit-msg b/hooks/prepare-commit-msg new file mode 100644 index 0000000..e7a276f --- /dev/null +++ b/hooks/prepare-commit-msg @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +## +# @see https://git-scm.com/docs/githooks#_prepare_commit_msg +## + +hasInput='true' +. "$(dirname $0)/_common" diff --git a/hooks/push-to-checkout b/hooks/push-to-checkout new file mode 100644 index 0000000..4597f1e --- /dev/null +++ b/hooks/push-to-checkout @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +## +# @see https://git-scm.com/docs/githooks#_push_to_checkout +## + +hasInput='true' +. "$(dirname $0)/_common" diff --git a/hooks/update b/hooks/update new file mode 100644 index 0000000..a5c5b87 --- /dev/null +++ b/hooks/update @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +## +# @see https://git-scm.com/docs/githooks#update +## + +hasInput='true' +. "$(dirname $0)/_common" diff --git a/post-applypatch b/post-applypatch deleted file mode 100644 index 2eae5fc..0000000 --- a/post-applypatch +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env bash -## -# This hook is invoked by git am. It takes no parameter, and is invoked after -# the patch is applied and a commit is made. -# -# This hook is meant primarily for notification, and cannot affect the outcome -# of git am. -# -# This hook is called with the following parameters: -# No parameters. -# -# Standard input format: -# NULL -## - -hasInput='true' -if [ "$(git rev-parse --is-bare-repository)" = 'true' ]; then - gitHooksBridge='./.git-hooks' -else - gitHooksBridge="$(git rev-parse --show-toplevel)/.git-hooks" -fi - -if [ -s "${gitHooksBridge}" ]; then - . "${gitHooksBridge}" || exit $? -fi - -exit 0 diff --git a/post-checkout b/post-checkout deleted file mode 100644 index 9cb5e05..0000000 --- a/post-checkout +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env bash -## -# This hook is invoked when a git checkout is run after having updated the -# worktree. The hook is given three parameters. -# This hook cannot affect the outcome of git checkout. -# -# It is also run after git clone, unless the --no-checkout (-n) option is used. -# The first parameter given to the hook is the null-ref, the second the ref of -# the new HEAD and the flag is always 1. -# -# This hook can be used to perform repository validity checks, auto-display -# differences from the previous HEAD if different, or set working dir metadata -# properties. -# -# This hook is called with the following parameters: -# - $1 The ref of the previous HEAD -# - $2 The ref of the new HEAD -# - $3 A flag indicating whether the checkout was a branch checkout -# (changing branches, flag=1) or a file checkout -# (retrieving a file from the index, flag=0) -# -# Standard input format: -# NULL -## - -hasInput='true' -if [ "$(git rev-parse --is-bare-repository)" = 'true' ]; then - gitHooksBridge='./.git-hooks' -else - gitHooksBridge="$(git rev-parse --show-toplevel)/.git-hooks" -fi - -if [ -s "${gitHooksBridge}" ]; then - . "${gitHooksBridge}" || exit $? -fi - -exit 0 diff --git a/post-commit b/post-commit deleted file mode 100644 index a8f03be..0000000 --- a/post-commit +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env bash -## -# This hook is invoked by git commit. It takes no parameter, and is invoked -# after a commit is made. -# -# This hook is meant primarily for notification, and cannot affect the outcome -# of git commit. -# -# This hook is called with the following parameters: -# No parameters. -# -# Standard input format: -# NULL -## - -hasInput='true' -if [ "$(git rev-parse --is-bare-repository)" = 'true' ]; then - gitHooksBridge='./.git-hooks' -else - gitHooksBridge="$(git rev-parse --show-toplevel)/.git-hooks" -fi - -if [ -s "${gitHooksBridge}" ]; then - . "${gitHooksBridge}" || exit $? -fi - -exit 0 diff --git a/post-merge b/post-merge deleted file mode 100644 index 8ae4c2b..0000000 --- a/post-merge +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env bash -## -# This hook is invoked by git merge, which happens when a git pull is done on a -# local repository. The hook takes a single parameter, a status flag specifying -# whether or not the merge being done was a squash merge. -# This hook cannot affect the outcome of git merge and is not executed, -# if the merge failed due to conflicts. -# -# This hook can be used in conjunction with a corresponding pre-commit hook to -# save and restore any form of metadata associated with the working tree -# (e.g.: permissions/ownership, ACLS, etc). -# See contrib/hooks/setgitperms.perl for an example of how to do this. -# -# This hook is called with the following parameters: -# - $1 Flag specifying whether or not the merge being done was a squash merge. -# -# Standard input format: -# NULL -## - -hasInput='true' -if [ "$(git rev-parse --is-bare-repository)" = 'true' ]; then - gitHooksBridge='./.git-hooks' -else - gitHooksBridge="$(git rev-parse --show-toplevel)/.git-hooks" -fi - -if [ -s "${gitHooksBridge}" ]; then - . "${gitHooksBridge}" || exit $? -fi - -exit 0 diff --git a/post-receive b/post-receive deleted file mode 100644 index e768c8d..0000000 --- a/post-receive +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env bash -## -# This hook is called with the following parameters: -# No parameters. -# -# Standard input format: -# - Old revision id. -# - New revision id. -# - Ref name -## - -hasInput='true' -if [ "$(git rev-parse --is-bare-repository)" = 'true' ]; then - gitHooksBridge='./.git-hooks' -else - gitHooksBridge="$(git rev-parse --show-toplevel)/.git-hooks" -fi - -if [ -s "${gitHooksBridge}" ]; then - . "${gitHooksBridge}" || exit $? -fi - -exit 0 diff --git a/post-rewrite b/post-rewrite deleted file mode 100644 index e3cf4f7..0000000 --- a/post-rewrite +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash -## -# The hook is called with the following parameters: -# - $1 Denotes the command it was invoked by: currently one of amend or rebase. -# -# Standard input format: -# SP [ SP ] LF -## - -hasInput='true' -if [ "$(git rev-parse --is-bare-repository)" = 'true' ]; then - gitHooksBridge='./.git-hooks' -else - gitHooksBridge="$(git rev-parse --show-toplevel)/.git-hooks" -fi - -if [ -s "${gitHooksBridge}" ]; then - . "${gitHooksBridge}" || exit $? -fi - -exit 0 diff --git a/post-update b/post-update deleted file mode 100644 index cd13f44..0000000 --- a/post-update +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash -## -# This hook is called with the following parameters: -# - $... It takes a variable number of parameters, -# each of which is the name of ref that was actually updated. -# -# Standard input format: -# NULL -## - -hasInput='true' -if [ "$(git rev-parse --is-bare-repository)" = 'true' ]; then - gitHooksBridge='./.git-hooks' -else - gitHooksBridge="$(git rev-parse --show-toplevel)/.git-hooks" -fi - -if [ -s "${gitHooksBridge}" ]; then - . "${gitHooksBridge}" || exit $? -fi - -exit 0 diff --git a/pre-applypatch b/pre-applypatch deleted file mode 100644 index 7c6f833..0000000 --- a/pre-applypatch +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env bash -## -# The hook should exit with non-zero status after issuing an appropriate message -# if it wants to stop the commit. -# -# This hook is called with the following parameters: -# It takes no parameter. -# -# Standard input format: -# NULL -## - -hasInput='true' -if [ "$(git rev-parse --is-bare-repository)" = 'true' ]; then - gitHooksBridge='./.git-hooks' -else - gitHooksBridge="$(git rev-parse --show-toplevel)/.git-hooks" -fi - -if [ -s "${gitHooksBridge}" ]; then - . "${gitHooksBridge}" || exit $? -fi - -exit 0 diff --git a/pre-commit b/pre-commit deleted file mode 100644 index 0e83af9..0000000 --- a/pre-commit +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env bash -## -# The hook should exit with non-zero status after issuing an appropriate message -# if it wants to stop the commit. -# -# This hook is called with the following parameters: -# No parameters. -# -# Standard input format: -# NULL -## - -hasInput='true' -if [ "$(git rev-parse --is-bare-repository)" = 'true' ]; then - gitHooksBridge='./.git-hooks' -else - gitHooksBridge="$(git rev-parse --show-toplevel)/.git-hooks" -fi - -if [ -s "${gitHooksBridge}" ]; then - . "${gitHooksBridge}" || exit $? -fi - -exit 0 diff --git a/pre-push b/pre-push deleted file mode 100644 index 6d8b466..0000000 --- a/pre-push +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env bash -## -# This hook is called with the following parameters: -# If pushing without using a named remote those arguments will be equal. -# - $1 Name of the remote to which the push is being done. -# - $2 URL to which the push is being done. -# -# Standard input format: -# Information about the commits which are being pushed is supplied as lines to -# the standard input in the form: -# - Local ref -# - Local sha1 -# - Remote ref -# - Remote sha1 -## - -hasInput='true' -if [ "$(git rev-parse --is-bare-repository)" = 'true' ]; then - gitHooksBridge='./.git-hooks' -else - gitHooksBridge="$(git rev-parse --show-toplevel)/.git-hooks" -fi - -if [ -s "${gitHooksBridge}" ]; then - . "${gitHooksBridge}" || exit $? -fi - -exit 0 diff --git a/pre-rebase b/pre-rebase deleted file mode 100644 index bf238d6..0000000 --- a/pre-rebase +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env bash -## -# The "pre-rebase" hook is run just before "git rebase" starts doing its job, -# and can prevent the command from running by exiting with non-zero status. -# -# The hook is called with the following parameters: -# - $1 The upstream the series was forked from. -# - $2 The branch being rebased (or empty when rebasing the current branch). -# -# Standard input format: -# NULL -## - -hasInput='true' -if [ "$(git rev-parse --is-bare-repository)" = 'true' ]; then - gitHooksBridge='./.git-hooks' -else - gitHooksBridge="$(git rev-parse --show-toplevel)/.git-hooks" -fi - -if [ -s "${gitHooksBridge}" ]; then - . "${gitHooksBridge}" || exit $? -fi - -exit 0 diff --git a/pre-receive b/pre-receive deleted file mode 100644 index fa2b9f8..0000000 --- a/pre-receive +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env bash -## -# This hook is invoked by git-receive-pack on the remote repository, which -# happens when a git push is done on a local repository. Just before starting to -# update refs on the remote repository, the pre-receive hook is invoked. -# Its exit status determines the success or failure of the update. -# -# This hook executes once for the receive operation. It takes no arguments, -# but for each ref to be updated it receives on standard input a line of the -# format: -# SP SP LF -# -# where is the old object name stored in the ref, -# is the new object name to be stored in the ref and -# is the full name of the ref. When creating a new ref, is 40 0. -# -# If the hook exits with non-zero status, none of the refs will be updated. -# If the hook exits with zero, updating of individual refs can still be -# prevented by the update hook. -# -# Both standard output and standard error output are forwarded to git send-pack -# on the other end, so you can simply echo messages for the user. -# -# This hook is called with the following parameters: -# No parameters. -# -# Standard input format: -# - Old revision id. -# - New revision id. -# - Ref name -## - -hasInput='true' -if [ "$(git rev-parse --is-bare-repository)" = 'true' ]; then - gitHooksBridge='./.git-hooks' -else - gitHooksBridge="$(git rev-parse --show-toplevel)/.git-hooks" -fi - -if [ -s "${gitHooksBridge}" ]; then - . "${gitHooksBridge}" || exit $? -fi - -exit 0 diff --git a/prepare-commit-msg b/prepare-commit-msg deleted file mode 100644 index d1a018d..0000000 --- a/prepare-commit-msg +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash -# -# Called by "git commit" with the name of the file that has the commit message, -# followed by the description of the commit message's source. -# The hook's purpose is to edit the commit message file. -# If the hook fails with a non-zero status, the commit is aborted. -# -# This hook is called with the following parameters: -# - $1 The name of the file that has the commit message. -# - $2 The description of the commit message's source. -# -# Standard input format: -# NULL - -hasInput='true' -if [ "$(git rev-parse --is-bare-repository)" = 'true' ]; then - gitHooksBridge='./.git-hooks' -else - gitHooksBridge="$(git rev-parse --show-toplevel)/.git-hooks" -fi - -if [ -s "${gitHooksBridge}" ]; then - . "${gitHooksBridge}" || exit $? -fi - -exit 0 diff --git a/push-to-checkout b/push-to-checkout deleted file mode 100644 index cdae90b..0000000 --- a/push-to-checkout +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash -## -# This hook is called with the following parameters: -# - $1 The hook receives the commit with which the tip of the current branch -# is going to be updated. -# -# Standard input format: -# NULL -## - -hasInput='true' -if [ "$(git rev-parse --is-bare-repository)" = 'true' ]; then - gitHooksBridge='./.git-hooks' -else - gitHooksBridge="$(git rev-parse --show-toplevel)/.git-hooks" -fi - -if [ -s "${gitHooksBridge}" ]; then - . "${gitHooksBridge}" || exit $? -fi - -exit 0 diff --git a/update b/update deleted file mode 100644 index 13e59f9..0000000 --- a/update +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env bash -## -# Called by "git receive-pack" -# A zero exit from the update hook allows the ref to be updated. -# Exiting with a non-zero status prevents git-receive-pack from updating that -# ref. -# -# This hook is called with the following parameters: -# - $1 refname -# - $2 sha1-old -# - $3 sha1-new -## - -hasInput='true' -if [ "$(git rev-parse --is-bare-repository)" = 'true' ]; then - gitHooksBridge='./.git-hooks' -else - gitHooksBridge="$(git rev-parse --show-toplevel)/.git-hooks" -fi - -if [ -s "${gitHooksBridge}" ]; then - . "${gitHooksBridge}" || exit $? -fi - -exit 0