aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorSitaram Chamarty <sitaram@atc.tcs.com>2014-05-02 11:12:14 +0530
committerSitaram Chamarty <sitaram@atc.tcs.com>2014-05-07 19:09:55 +0530
commitb607f55bb273f56a0d9148031ce67cd5a9280f37 (patch)
tree78bb751f24816da4df38e36df425e93f5eb164eb /t
parentget ldap groups (diff)
downloadgitolite-gentoo-b607f55bb273f56a0d9148031ce67cd5a9280f37.tar.gz
gitolite-gentoo-b607f55bb273f56a0d9148031ce67cd5a9280f37.tar.bz2
gitolite-gentoo-b607f55bb273f56a0d9148031ce67cd5a9280f37.zip
repo-specific hooks: make them upgradable from 3.5.3.1,
also fix a buglet (tests courtesy milki)
Diffstat (limited to 't')
-rwxr-xr-xt/repo-specific-hooks.t64
1 files changed, 48 insertions, 16 deletions
diff --git a/t/repo-specific-hooks.t b/t/repo-specific-hooks.t
index b68d958..88976ca 100755
--- a/t/repo-specific-hooks.t
+++ b/t/repo-specific-hooks.t
@@ -9,8 +9,9 @@ use Gitolite::Test;
# test script for partial copy feature
# ----------------------------------------------------------------------
-try "plan 99";
+try "plan 117";
my $h = $ENV{HOME};
+my $rb = `gitolite query-rc -n GL_REPO_BASE`;
try 'cd tsh_tempdir; mkdir -p local/hooks/repo-specific';
@@ -40,35 +41,66 @@ try "# Enable LOCAL_CODE and repo-specific-hooks
confreset;confadd '
repo foo
RW+ = @all
- option hook.post-receive = first
repo bar
RW+ = @all
- option hook.pre-receive = first second
repo baz
RW+ = @all
- option hook.post-receive = first
- option hook.post-update = first second
';
-
-try "ADMIN_PUSH repo-specific-hooks; !/FATAL/" or die text();
+try "ADMIN_PUSH repo-specific-hooks-0; !/FATAL/" or die text();
try "
/Init.*empty.*foo\\.git/
/Init.*empty.*bar\\.git/
+ /Init.*empty.*baz\\.git/
";
-my $rb = `gitolite query-rc -n GL_REPO_BASE`;
-try "
- ls $rb/foo.git/hooks/*; ok; /post-receive.h00-first/
- !/post-receive.h01/
- ls $rb/bar.git/hooks/*; ok; /pre-receive.h00-first/
- /pre-receive.h01-second/
- ls $rb/baz.git/hooks/*; ok; /post-receive.h00-first/
- /post-update.h00-first/
- /post-update.h01-second/
+my $failing_hook = "#!/bin/sh
+exit 1
+";
+
+# Place a existing hooks in repos
+put "$rb/foo.git/hooks/post-recieve", $failing_hook;
+put "$rb/bar.git/hooks/pre-recieve", $failing_hook;
+put "$rb/baz.git/hooks/post-update", $failing_hook;
+
+try "# Verify hooks
+ ls -l $rb/foo.git/hooks/*; ok; !/post-receive -. .*local/hooks/multi-hook-driver/
+ ls -l $rb/bar.git/hooks/*; ok; !/pre-receive -. .*local/hooks/multi-hook-driver/
+ ls -l $rb/baz.git/hooks/*; ok; !/post-update -. .*local/hooks/multi-hook-driver/
+";
+
+confreset;confadd '
+ repo foo
+ RW+ = @all
+ option hook.post-receive = first
+
+ repo bar
+ RW+ = @all
+ option hook.pre-receive = first second
+
+ repo baz
+ RW+ = @all
+ option hook.post-receive = first
+ option hook.post-update = first second
+';
+
+
+try "ADMIN_PUSH repo-specific-hooks-1; !/FATAL/" or die text();
+
+try "# Verify hooks
+ ls -l $rb/foo.git/hooks/*; ok; /post-receive.h00-first/
+ !/post-receive.h01/
+ /post-receive -. .*local/hooks/multi-hook-driver/
+ ls -l $rb/bar.git/hooks/*; ok; /pre-receive.h00-first/
+ /pre-receive.h01-second/
+ /pre-receive -. .*local/hooks/multi-hook-driver/
+ ls -l $rb/baz.git/hooks/*; ok; /post-receive.h00-first/
+ /post-update.h00-first/
+ /post-update.h01-second/
+ /post-update -. .*local/hooks/multi-hook-driver/
";
try "