From be61cd2d66da5729a7506e852262171ce1ea6ead Mon Sep 17 00:00:00 2001 From: Sitaram Chamarty Date: Tue, 6 Nov 2012 06:19:13 +0530 Subject: [PATCH] make sure gl-perms exists, even if it is empty... I expect this to help if we optimise the rule generation by caching. --- src/commands/fork | 1 + src/lib/Gitolite/Conf/Store.pm | 2 +- t/fork.t | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/commands/fork b/src/commands/fork index 6cd6eea..1d68d64 100755 --- a/src/commands/fork +++ b/src/commands/fork @@ -48,6 +48,7 @@ echo "$from forked to $to" >&2 cd $GL_REPO_BASE/$to.git echo $GL_USER > gl-creator +touch gl-perms if gitolite query-rc -q DEFAULT_ROLE_PERMS then gitolite query-rc DEFAULT_ROLE_PERMS > gl-perms diff --git a/src/lib/Gitolite/Conf/Store.pm b/src/lib/Gitolite/Conf/Store.pm index 4d1c642..8e2e6c8 100644 --- a/src/lib/Gitolite/Conf/Store.pm +++ b/src/lib/Gitolite/Conf/Store.pm @@ -191,7 +191,7 @@ sub new_wild_repo { trigger( 'PRE_CREATE', $repo, $user, $aa ); new_repo($repo); _print( "$repo.git/gl-creator", $user ); - _print( "$repo.git/gl-perms", "$rc{DEFAULT_ROLE_PERMS}\n" ) if $rc{DEFAULT_ROLE_PERMS}; + _print( "$repo.git/gl-perms", ( $rc{DEFAULT_ROLE_PERMS} ? "$rc{DEFAULT_ROLE_PERMS}\n" : "" ) ); trigger( 'POST_CREATE', $repo, $user, $aa ); _chdir( $rc{GL_ADMIN_BASE} ); diff --git a/t/fork.t b/t/fork.t index d595847..99d4a41 100755 --- a/t/fork.t +++ b/t/fork.t @@ -61,7 +61,8 @@ try " my $t; try "cd $rb; find . -name gl-perms"; $t = md5sum(sort (lines())); cmp $t, -'59b3a74b4d33c7631f08e75e7b60c7ce ./foo/u1/u1a2.git/gl-perms +'d41d8cd98f00b204e9800998ecf8427e ./foo/u1/u1a.git/gl-perms +59b3a74b4d33c7631f08e75e7b60c7ce ./foo/u1/u1a2.git/gl-perms 59b3a74b4d33c7631f08e75e7b60c7ce ./foo/u1/u1e.git/gl-perms ';