summaryrefslogtreecommitdiffstats
path: root/src/commands/create
blob: 8565e68198d354831f23e0651dd2d6131e5d0335 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/perl
use strict;
use warnings;

use lib $ENV{GL_LIBDIR};
use Gitolite::Rc;
use Gitolite::Common;
use Gitolite::Conf::Load;
use Gitolite::Conf::Store;

=for usage
create -- create a wild repo.

Usage:
    ssh git@host create <repo>
=cut

usage() if @ARGV != 1 or $ARGV[0] eq '-h';

$ENV{GL_USER} or _die "GL_USER not set";

my $repo = shift;
_die "invalid repo '$repo'" unless $repo =~ $REPONAME_PATT;

my $ret = access( $repo, $ENV{GL_USER}, '^C', 'any' );
_die "repo already exists or you are not authorised to create it" if $ret =~ /DENIED/;

new_wild_repo( $repo, $ENV{GL_USER}, 'create' );
gl_log( 'create', $repo, $ENV{GL_USER}, 'create' );