From bb9f045ec37220c75b08e805b3325e28aad1da18 Mon Sep 17 00:00:00 2001 From: Sitaram Chamarty Date: Wed, 21 Mar 2012 13:23:32 +0530 Subject: [PATCH] trigger POST_CREATE from user actions - uncomment the POST_CREATE section in rc by default now - have perms call 'gitolite trigger POST_CREATE' --- src/Gitolite/Rc.pm | 6 ++-- src/commands/perms | 3 +- t/git-config.t | 89 +++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 93 insertions(+), 5 deletions(-) diff --git a/src/Gitolite/Rc.pm b/src/Gitolite/Rc.pm index 79ec246..7b83e9b 100644 --- a/src/Gitolite/Rc.pm +++ b/src/Gitolite/Rc.pm @@ -260,9 +260,9 @@ __DATA__ # these will run in sequence after a new wild repo is created POST_CREATE => [ - # 'post-compile/update-git-configs', - # 'post-compile/update-gitweb-access-list', - # 'post-compile/update-git-daemon-access-list', + 'post-compile/update-git-configs', + 'post-compile/update-gitweb-access-list', + 'post-compile/update-git-daemon-access-list', ], # comment out or uncomment as needed diff --git a/src/commands/perms b/src/commands/perms index 08faff4..a476241 100755 --- a/src/commands/perms +++ b/src/commands/perms @@ -35,6 +35,7 @@ if ( $ARGV[0] eq '-l' ) { } setperms(@ARGV); +_system("gitolite", "trigger", "POST_CREATE"); # ---------------------------------------------------------------------- @@ -62,7 +63,7 @@ sub setperms { push @a, $_; } _print( $pf, @a ); - exit; + return; } _die "Invalid syntax. Please re-run with '-h' for detailed usage" if @_ != 3; diff --git a/t/git-config.t b/t/git-config.t index b3ea176..83ad7f4 100755 --- a/t/git-config.t +++ b/t/git-config.t @@ -9,12 +9,25 @@ use Gitolite::Test; # git config settings # ---------------------------------------------------------------------- -try "plan 21"; +try "plan 57"; try "pwd"; my $od = text(); chomp($od); +# try an invalid config key +confreset;confadd ' + + repo @all + config foo.bar = dft +'; + +try "ADMIN_PUSH set1; /FATAL/" or die text(); +try " + /git config foo.bar not allowed/ + /check GIT_CONFIG_KEYS in the rc file/ +"; + # make foo.bar a valid gc key $ENV{G3T_RC} = "$ENV{HOME}/g3trc"; put "$ENV{G3T_RC}", "\$rc{GIT_CONFIG_KEYS} = 'foo\.bar';\n"; @@ -101,3 +114,77 @@ testing.git/config: bar = dft testing.git/config: bare = true testing.git/config:[foo] '; + +try "cd $od; ok"; + +confadd ' + + repo bar + RW = u2 + config foo.bar = + +'; + +try "ADMIN_PUSH set1; !/FATAL/" or die text(); + +try " + cd $rb; ok + egrep foo\\|bar *.git/config | sort +"; + +cmp 'bar.git/config: bare = true +bar.git/config:[foo] +foo.git/config: bare = true +foo.git/config: bar = f1 +foo.git/config:[foo] +frob.git/config: bare = true +frob.git/config: bar = none +frob.git/config:[foo] +gitolite-admin.git/config: bare = true +testing.git/config: bar = dft +testing.git/config: bare = true +testing.git/config:[foo] +'; + +try "cd $od; ok"; + +confreset;confadd ' + + repo @gr1 + RW = u1 + config foo.bar = f1 + + repo bar/CREATOR/[one].* + C = u2 + RW = u2 + config foo.bar = one + + @gr1 = foo frob + +'; +try "ADMIN_PUSH set1; !/FATAL/" or die text(); +try " + glt ls-remote u2 file:///bar/u2/one; ok; /Initialized empty/ + glt ls-remote u2 file:///bar/u2/two; !ok; /DENIED by fallthru/ +"; + +try " + cd $rb; ok + egrep foo\\|bar *.git/config | sort + find . -name config | xargs egrep foo\\|bar | sort +"; + +cmp './bar/u2/one.git/config: bare = true +./bar/u2/one.git/config: bar = one +./bar/u2/one.git/config:[foo] +./foo.git/config: bare = true +./foo.git/config: bar = f1 +./foo.git/config:[foo] +./frob.git/config: bare = true +./frob.git/config: bar = f1 +./frob.git/config:[foo] +./gitolite-admin.git/config: bare = true +./testing.git/config: bar = dft +./testing.git/config: bare = true +./testing.git/config:[foo] +';