Permalink
Browse files

new command 'owns' (thanks to Kevin Pulo)

  • Loading branch information...
1 parent 797a81f commit 09e3a3ca477b2569fd70c46fc5493402da30d674 @sitaramc sitaramc committed Mar 20, 2013
Showing with 24 additions and 2 deletions.
  1. +22 −0 src/commands/owns
  2. +2 −2 src/lib/Gitolite/Easy.pm
View
@@ -0,0 +1,22 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+use lib $ENV{GL_LIBDIR};
+use Gitolite::Easy;
+
+=for usage
+Usage: gitolite owns <reponame>
+
+Checks if $GL_USER is an owner of the repo and returns an exit code (shell
+truth, 0 for success), which makes it possible to do this in shell:
+
+ if gitolite owns someRepo
+ then
+ ...
+=cut
+
+usage() if not @ARGV or $ARGV[0] eq '-h';
+my $repo = shift;
+
+exit not owns($repo);
View
@@ -124,8 +124,8 @@ sub in_role {
# return true if $ENV{GL_USER} is set and is an OWNER of the given repo.
-# shell equivalent
-# if gitolite creator $REPONAME $GL_USER; then ...
+# shell equivalent (assuming GL_USER is set)
+# if gitolite owns $REPONAME; then ...
sub owns {
valid_user();
my $r = shift;

0 comments on commit 09e3a3c

Please sign in to comment.