fixed up several broken URLs (minor but annoying)
[gitolite.git] / src / commands / creator
blob702df73f2186721d40364e06533899672df63a51
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
5 use lib $ENV{GL_LIBDIR};
6 use Gitolite::Rc;
7 use Gitolite::Common;
8 use Gitolite::Conf::Load;
10 =for usage
11 Usage: gitolite creator [-n] <reponame> [<username>]
13 Print the creator name for the repo. A '-n' suppresses the newline.
15 When an optional username is supplied, it checks if the user is the creator of
16 the repo and returns an exit code (shell truth, 0 for success) instead of
17 printing anything, which makes it possible to do this in shell:
19 if gitolite creator someRepo someUser
20 then
21 ...
22 =cut
24 usage() if not @ARGV or $ARGV[0] eq '-h';
25 my $nl = "\n";
26 if ( $ARGV[0] eq '-n' ) {
27 $nl = '';
28 shift;
30 my $repo = shift;
31 my $user = shift || '';
33 my $creator = '';
34 $creator = creator($repo) if not repo_missing($repo);
35 if ($user) {
36 exit 0 if $creator eq $user;
37 exit 1;
39 return ( $creator eq $user ) if $user;
40 print "$creator$nl";