Skip to content

Commit

Permalink
(minor) perltidy on gitpod, a comment fixup on t/t01
Browse files Browse the repository at this point in the history
  • Loading branch information
sitaramc committed Jan 16, 2012
1 parent f9c971d commit 9fc1d2b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 29 deletions.
56 changes: 28 additions & 28 deletions gitpod
Expand Up @@ -5,34 +5,34 @@ use warnings;
# can something be quick and dirty, but also secure?

# this covers all types of invocations
shift if ($ARGV[0] || '') eq '-c';
my $cmd = '';
$cmd ||= $ENV{SSH_ORIGINAL_COMMAND};
$cmd ||= ( join (" ", @ARGV) );
shift if ( $ARGV[0] || '' ) eq '-c';
my $cmd = '';
$cmd ||= $ENV{SSH_ORIGINAL_COMMAND};
$cmd ||= ( join( " ", @ARGV ) );

# no buffering
select(STDERR); $|++; select(STDOUT); $|++;
select(STDERR); $|++; select(STDOUT); $|++;

# safety first
die "need a command\n" unless $cmd;
die "invalid character $1 in $cmd\n" if $cmd =~ m(([^-+=:'""'./@ \w]));
die "I don't like .. in $cmd\n" if $cmd =~ /\.\./;
die "I don't like leading / in $cmd\n" if $cmd =~ m((^|\s)/);
die "need a command\n" unless $cmd;
die "invalid character $1 in $cmd\n" if $cmd =~ m(([^-+=:'""'./@ \w]));
die "I don't like .. in $cmd\n" if $cmd =~ /\.\./;
die "I don't like leading / in $cmd\n" if $cmd =~ m((^|\s)/);

# 5 basic commands
if ($cmd eq 'info') {
list_repos();
} elsif ($cmd =~ /^clone (\S+) (\S+)$/) {
clone($1, $2);
} elsif ($cmd =~ /^lazy-fetch (\S+)$/) {
fetch($1) unless lazy($1);
} elsif ($cmd =~ /^fetch (\S+)$/) {
fetch($1);
} elsif ($cmd =~ /^git-upload-pack (.+)$/) {
upload($1);
} else {
die "unknown command $cmd\n";
}
if ( $cmd eq 'info' ) {
list_repos();
} elsif ( $cmd =~ /^clone (\S+) (\S+)$/ ) {
clone( $1, $2 );
} elsif ( $cmd =~ /^lazy-fetch (\S+)$/ ) {
fetch($1) unless lazy($1);
} elsif ( $cmd =~ /^fetch (\S+)$/ ) {
fetch($1);
} elsif ( $cmd =~ /^git-upload-pack (.+)$/ ) {
upload($1);
} else {
die "unknown command $cmd\n";
}

# ----------------------------------------------------------------------

Expand Down Expand Up @@ -66,17 +66,17 @@ sub upload {

fetch($repo) unless lazy($repo);

exec("git", "shell", "-c", "git-upload-pack '$repo'");
# XXX this is weird. gl-auth-command does not require those single
# quotes but this one does. Without them, you get "fatal: bad
# argument" followed by "...remote hung up..."
exec( "git", "shell", "-c", "git-upload-pack '$repo'" );
# XXX this is weird. gl-auth-command does not require those single
# quotes but this one does. Without them, you get "fatal: bad
# argument" followed by "...remote hung up..."
}

sub clone {
my ($remote, $local) = @_;
my ( $remote, $local ) = @_;
$local =~ s/\.git$//;

my $cmd="git clone --progress --mirror $remote $local.git";
my $cmd = "git clone --progress --mirror $remote $local.git";
print STDERR "running: $cmd\n";
system($cmd) and die "FATAL: git clone failed; check messages above\n";
}
2 changes: 1 addition & 1 deletion t/t01
Expand Up @@ -12,7 +12,7 @@ use Tsh;
# settings/defines
my $rr="$HOME/gitpod-remote-repos";

# check git-test and gitpod are in $PATH
# check tsh and gitpod are in $PATH
try "
which tsh; ok or tsh not in PATH
which gitpod; ok or gitpod not in PATH
Expand Down

0 comments on commit 9fc1d2b

Please sign in to comment.