From 34aad344783d95a4329fd5db1b983a1ffe150fe3 Mon Sep 17 00:00:00 2001 From: Sitaram Chamarty Date: Fri, 16 Apr 2010 19:19:50 +0530 Subject: [PATCH] make "expand" also print version, like "info" does (thanks to Ilari for catching this) --- src/gitolite.pm | 15 +++++++++++---- src/gl-auth-command | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/gitolite.pm b/src/gitolite.pm index 9850af8..3bc513f 100644 --- a/src/gitolite.pm +++ b/src/gitolite.pm @@ -277,6 +277,12 @@ sub parse_acl # print a report of $user's basic permissions # ---------------------------------------------------------------------------- +sub report_version { + my($GL_ADMINDIR, $user) = @_; + print "hello $user, the gitolite version here is "; + system("cat", ($GL_PACKAGE_CONF || "$GL_ADMINDIR/conf") . "/VERSION"); +} + # basic means wildcards will be shown as wildcards; this is pretty much what # got parsed by the compile script sub report_basic @@ -286,9 +292,8 @@ sub report_basic &parse_acl($GL_CONF_COMPILED, "", "CREATER", "READERS", "WRITERS"); # send back some useful info if no command was given - print "hello $user, the gitolite version here is "; - system("cat", ($GL_PACKAGE_CONF || "$GL_ADMINDIR/conf") . "/VERSION"); - print "\ryou have the following permissions:\r\n"; + &report_version($GL_ADMINDIR, $user); + print "\rthe gitolite config gives you the following access:\r\n"; for my $r (sort keys %repos) { # @all repos; meaning of read/write flags: # @ => @all users are allowed access to this repo @@ -307,8 +312,10 @@ sub report_basic sub expand_wild { - my($GL_CONF_COMPILED, $repo_base_abs, $repo, $user) = @_; + my($GL_ADMINDIR, $GL_CONF_COMPILED, $repo_base_abs, $repo, $user) = @_; + &report_version($GL_ADMINDIR, $user); + print "\ryou have access to the following repos on the server:\r\n"; # this is for convenience; he can copy-paste the output of the basic # access report instead of having to manually change CREATER to his name $repo =~ s/\bCREAT[EO]R\b/$user/g; diff --git a/src/gl-auth-command b/src/gl-auth-command index 583cd4e..24fc5b9 100755 --- a/src/gl-auth-command +++ b/src/gl-auth-command @@ -127,7 +127,7 @@ if ($ENV{SSH_ORIGINAL_COMMAND} =~ $CUSTOM_COMMANDS) { elsif ($verb eq 'expand') { # with a wildcard, you can "expand" it to see what repos actually match die "$repo has invalid characters" unless "x$repo" =~ $REPOPATT_PATT; - expand_wild($GL_CONF_COMPILED, $repo_base_abs, $repo, $user); + expand_wild($GL_ADMINDIR, $GL_CONF_COMPILED, $repo_base_abs, $repo, $user); } else { die "$cmd doesn't make sense to me\n"; }