From 56be906e5d739037f640d9aa2d9cb9c46910a6de Mon Sep 17 00:00:00 2001 From: Sitaram Chamarty Date: Fri, 9 Mar 2012 13:33:32 +0530 Subject: [PATCH] deny message change; t01 also changed accordingly --- Gitolite/Conf/Load.pm | 10 +++++----- g3-info | 2 +- gitolite-shell | 6 +++--- t/t01-basic | 12 ++++++------ 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Gitolite/Conf/Load.pm b/Gitolite/Conf/Load.pm index 3237748..fd117fc 100644 --- a/Gitolite/Conf/Load.pm +++ b/Gitolite/Conf/Load.pm @@ -69,13 +69,13 @@ sub access { trace( 4, "perm=$perm, refex=$refex" ); # skip 'deny' rules if the ref is not (yet) known - next if $perm eq '-' and $ref eq 'unknown'; + next if $perm eq '-' and $ref eq 'any'; - # rule matches if ref matches or ref is unknown (see gitolite-shell) - next unless $ref =~ /^$refex/ or $ref eq 'unknown'; + # rule matches if ref matches or ref is any (see gitolite-shell) + next unless $ref =~ /^$refex/ or $ref eq 'any'; trace( 3, "DENIED by $refex" ) if $perm eq '-'; - return "DENIED: $aa access to $repo by $user (rule: $refex)" if $perm eq '-'; + return "$aa $ref $repo $user DENIED by $refex" if $perm eq '-'; # $perm can be RW\+?(C|D|CD|DC)?M?. $aa can be W, +, C or D, or # any of these followed by "M". @@ -85,7 +85,7 @@ sub access { return $refex if ( $perm =~ /$aaq/ ); } trace( 3, "DENIED by fallthru" ); - return "DENIED: $aa access to $repo by $user (fallthru)"; + return "$aa $ref $repo $user DENIED by fallthru"; } # ---------------------------------------------------------------------- diff --git a/g3-info b/g3-info index d4db40e..28fa9ad 100755 --- a/g3-info +++ b/g3-info @@ -20,7 +20,7 @@ use warnings; my $user = shift or die; my $aa; -my $ref = 'unknown'; +my $ref = 'any'; my $ret; while (<>) { diff --git a/gitolite-shell b/gitolite-shell index 59b2984..46ce08b 100755 --- a/gitolite-shell +++ b/gitolite-shell @@ -31,11 +31,11 @@ sanity($repo); $ENV{GL_REPO} = $repo; my $aa = ( $verb =~ 'upload' ? 'R' : 'W' ); -# a ref of 'unknown' signifies that this is a pre-git check, where we don't +# a ref of 'any' signifies that this is a pre-git check, where we don't # yet know the ref that will be eventually pushed (and even that won't apply # if it's a read operation). See the matching code in access() for more. -my $ret = access( $repo, $user, $aa, 'unknown' ); -trace( 1, "access($repo, $user, $aa, 'unknown') -> $ret" ); +my $ret = access( $repo, $user, $aa, 'any' ); +trace( 1, "access($repo, $user, $aa, 'any') -> $ret" ); _die $ret if $ret =~ /DENIED/; $repo = "'$rc{GL_REPO_BASE}/$repo.git'"; diff --git a/t/t01-basic b/t/t01-basic index 3970308..96d9fc9 100755 --- a/t/t01-basic +++ b/t/t01-basic @@ -15,7 +15,7 @@ try " ## clone glt clone dev2 file://gitolite-admin !ok; gsh - /FATAL: DENIED: R access to gitolite-admin by dev2 .fallthru./ + /DENIED by fallthru/ /fatal: The remote end hung up unexpectedly/ glt clone admin --progress file://gitolite-admin ok; gsh @@ -40,13 +40,13 @@ try " git status -s; ok; /M conf/gitolite.conf/ git commit -m t01a; ok; /master.*t01a/ glt push dev2 origin; !ok; gsh - /FATAL: DENIED: W access to gitolite-admin by dev2 .fallthru./ + /DENIED by fallthru/ /fatal: The remote end hung up unexpectedly/ glt push admin origin; ok; /master -. master/ tsh empty; ok; glt push admin origin master:mm !ok; gsh - /FATAL: DENIED: W access to gitolite-admin by admin .rule: refs/heads/mm./ + /DENIED by refs/heads/mm/ /remote: error: hook declined to update refs/heads/mm/ /To file://gitolite-admin/ /remote rejected. master -. mm .hook declined./ @@ -79,7 +79,7 @@ try " ## clone cd ..; ok; glt clone u1 file://t1; !ok; gsh - /FATAL: DENIED: R access to t1 by u1 .fallthru./ + /DENIED by fallthru/ /fatal: The remote end hung up unexpectedly/ glt clone u2 file://t1; ok; gsh /warning: You appear to have cloned an empty repository./ @@ -89,7 +89,7 @@ try " ## push test-commit tc1 tc2 tc2; ok; /f7153e3/ glt push u2 origin; !ok; gsh - /FATAL: DENIED: W access to t1 by u2 .fallthru./ + /DENIED by fallthru/ /fatal: The remote end hung up unexpectedly/ glt push u3 origin master; ok; gsh /master -. master/ @@ -100,7 +100,7 @@ try " glt push u3 origin; !ok; gsh /rejected.*master -. master.*non-fast-forward./ glt push u3 -f origin; !ok; gsh - /FATAL: DENIED: \\+ access to t1 by u3 .fallthru./ + /DENIED by fallthru/ /remote: error: hook declined to update refs/heads/master/ /To file://t1/ /remote rejected. master -. master .hook declined./