#!/usr/bin/perl
use 5.10.0;
use strict;
use warnings;
use lib "$ENV{HOME}/bin";
use Tsh;
run 'plan 39';
my $rr="$HOME/gitpod-remote-repos";
try "
which tsh; ok or tsh not in PATH
which gitpod; ok or gitpod not in PATH
" or die;
run('which gitpod') eq run('grep ^$USER: /etc/passwd | cut -f7 -d:')
or die "login shell is not the right one";
cd; rm("-rf $rr non-bare r[1234].git sub[1234] u .gitpod.rc");
try "
ssh -o preferredauthentications=publickey $USER\@localhost info
/hello, this is gitpod/ or ssh setup is not complete
" or die;
try "mkdir -p $rr/r{1,2,3,4}"
or die "mkdir $rr/... failed\n";
unless (try("git config --get user.name")) {
say '...creating git configs...';
run "git config --global user.name 'git cephalopod'
git config --global user.email 'git-cephalopod\@example.com'";
}
for my $r (qw(r1 r2 r3 r4)) {
try "
cd $rr/$r; git init --bare
cd; rm -rf non-bare; git clone $rr/$r non-bare
cd non-bare; tc $r; tc m1; tc m2; branch AA; tc m3; tc m4; checkout AA; tc a1; tc a2
push --all origin
/new.branch.*AA.*AA/ or push branch AA failed
/new.branch.*master.*master/ or push branch master failed
" or die;
}
try ' cd; mkdir sub2 sub4 ' or die 'mkdir sub2 sub4 failed';
try "
gitpod clone file:///$rr/r1 r1
gitpod clone file:///$rr/r2 sub2/r2
ssh $USER\@localhost clone file:///$rr/r3 r3
ssh $USER\@localhost clone file:///$rr/r4 sub4/r4
" or die error_list();
try "
git ls-remote r1.git; /3ba846a/; /fc7a819/
git ls-remote sub2/r2.git; /c4c7d55/; /50d9881/
git ls-remote r3.git; /b499b19/; /e4cc88d/
git ls-remote sub4/r4.git; /af0f123/; /cd3734f/
ssh $USER\@localhost info
/r1/; /r3/; /sub2/r2/; /sub4/r4/
ssh $USER\@localhost fetch r1; /fetching from/; !/From file/
DEF delete-AA = cd $HOME/r1.git; branch -D AA; /Deleted branch AA/; git gc --prune=now; cd $HOME
delete-AA; ssh $USER\@localhost fetch r1; /fetching from/; /From file/
mkdir u
git clone $USER\@localhost:r1 u/r1; cd u/r1; git ls-remote origin; ok; /3ba846a/; /fc7a819/
delete-AA; cd $HOME/u/r1; git fetch; /new.branch.*AA.*AA/
git fetch; !/new.branch.*AA.*AA/
ENV TSH_VERBOSE=0
echo LAZY = all > $HOME/.gitpod.rc
delete-AA; cd $HOME/u/r1; git fetch; !/new.branch.*AA.*AA/
ssh $USER\@localhost fetch r1; /new.branch.*AA.*AA/
delete-AA; gitpod fetch r1; /new.branch.*AA.*AA/
" or die scalar(error_list());