summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Rayhawk <jrayhawk@omgwallhack.org>2011-05-30 23:55:18 -0700
committerJoe Rayhawk <jrayhawk@omgwallhack.org>2011-05-30 23:55:18 -0700
commitab2df0b7b3ff8020abadd9ad338600e771064961 (patch)
treebcb7ff47da4c7ca8b7628ca6fc0b9beebbe2ece4
parentcd3ea35e724757aa86f6db16afb16dd280c303f4 (diff)
downloadpiny-code-ab2df0b7b3ff8020abadd9ad338600e771064961.tar.gz
piny-code-ab2df0b7b3ff8020abadd9ad338600e771064961.zip
Adding primitive cloning support
-rw-r--r--libpiny/lib/Piny/Repo.pm4
-rwxr-xr-xpinyadmin/sbin/newrepo19
2 files changed, 17 insertions, 6 deletions
diff --git a/libpiny/lib/Piny/Repo.pm b/libpiny/lib/Piny/Repo.pm
index 82f651d..8a26563 100644
--- a/libpiny/lib/Piny/Repo.pm
+++ b/libpiny/lib/Piny/Repo.pm
@@ -473,8 +473,8 @@ sub create {
chdir( "/srv/git" ); # so git-clone can do the work of resolving local repo names for us
if ( defined $source ) {
- system( "/bin/chown", $user . "." . $user, $repo->path ) and die "Could not change ownership of repo path!"; # permissions are overridden later
- if ( system( "/usr/bin/sudo", "-u", $user, "/usr/bin/git", "clone", "--bare", "--no-hardlinks", "--quiet", $source, $repo->path ) ) { # sudo -u $user needed in order to test user readability of whatever they want to clone. the mode o+rx should probably be masked off if we want private repos to stay private.
+ system( "/bin/chown", $user->name, $repo->path ) and die "Could not change ownership of repo path!"; # permissions are overridden later
+ if ( system( "/usr/bin/sudo", "-u", $user->name, "/usr/bin/git", "clone", "--bare", "--no-hardlinks", "--quiet", $source, $repo->path ) ) { # sudo -u $user needed in order to test user readability of whatever they want to clone. the mode o+rx should probably be masked off if we want private repos to stay private.
system( "/bin/rm", "-r", $repo->path ) and die "Failed to clean up after failed clone operation!";
die( "Could not clone repository!\n" );
};
diff --git a/pinyadmin/sbin/newrepo b/pinyadmin/sbin/newrepo
index 0a6cdf0..a13a0dc 100755
--- a/pinyadmin/sbin/newrepo
+++ b/pinyadmin/sbin/newrepo
@@ -7,12 +7,12 @@ use Moose::Util::TypeConstraints qw( find_type_constraint );
use Piny;
-my ( $batch, $name );
+my ( $batch, $name, $remote );
if ( $ARGV[0] eq "--batch" ) {
- ( $batch, $name ) = @ARGV;
+ ( $batch, $name, $remote ) = @ARGV;
} else {
- ( $name ) = @ARGV;
+ ( $name, $remote ) = @ARGV;
};
if ( not defined $name ) {
@@ -59,9 +59,20 @@ A new piny repo ``$name'' has been created.
Description: $description
END
+
+if( defined( $remote ) ) {
+ print( MAIL "\nRemote: $remote\n" );
+};
+
close( MAIL );
-my $repo = Piny::Repo->create( $name, $description );
+my $repo;
+
+if( defined( $remote ) ) {
+ $repo = Piny::Repo->create( $name, $description, $remote );
+} else {
+ $repo = Piny::Repo->create( $name, $description );
+};
print "Repo URL: " . $repo->ikiwiki_url . "\n";
print "Repo URL: " . $repo->cgit_url . "\n";