App-GitGot
view release on metacpan or search on metacpan
lib/App/GitGot/Command/fork.pm view on Meta::CPAN
120121122123124125126127128129130131132133134135136137138139140=head1 VERSION
version 1.339
=head1 SYNOPSIS
# fork repo on GitHub, then clone repository and add to got config
$ got fork github.com/owner/repo
# fork repo on GitHub, add to got config, but do _not_ clone locally
$ got fork -n github.com/owner/repo
$ got fork --noclone github.com/owner/repo
=head1 AUTHOR
John SJ Anderson <john@genehack.org>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2020 by John SJ Anderson.
202122232425262728293031323334353637383940{
my
$result
= test_app(
'App::GitGot'
=> [
'add'
]);
is
$result
->stdout ,
''
,
'empty STDOUT'
;
like
$result
->stderr ,
qr/Non-git repos not supported/
,
'expected error on STDERR'
;
is
$result
->exit_code , 1 ,
'exit with 1'
;
}
my
$config
=
"$dir/gitgot"
;
file_not_exists_ok
$config
,
'no config'
;
Test::BASE::build_fake_git_repo();
{
my
$result
= test_app(
'App::GitGot'
=> [
'add'
,
'-f'
,
$config
,
'-D'
]);
like
$result
->stdout,
qr/
Add \s repository \s at \s '.*?'\? \s+ \(y\/
n\) \s \[y\]: \s y \s+
Name\? \s+ \[foo.git\]: \s+ foo.git \s+
Tracking \s remote\? \s+ : \s+
t/04-clone.t view on Meta::CPAN
91011121314151617181920212223242526272829303132333435363738394041use
Test::File;
use
Test::More;
use
App::Cmd::Tester;
use
App::GitGot;
use
Path::Tiny;
my
$dir
= Test::BASE::create_tempdir_and_chdir();
my
$config
= path(
"$dir/gitgot"
);
file_not_exists_ok
$config
,
'config does not exist'
;
$ENV
{GITGOT_FAKE_GIT_WRAPPER} = 1;
{
my
$result
= test_app(
'App::GitGot'
=> [
'clone'
,
'-f'
,
$config
]);
is
$result
->stdout ,
''
,
'nothing on STDOUT'
;
like
$result
->stderr ,
qr/ERROR: Need the URL to clone/
,
'need to give a URL'
;
is
$result
->exit_code , 1 ,
'exit with 1'
;
file_not_exists_ok
$config
,
'failed command does not create config'
;
}
{
my
$result
= test_app(
'App::GitGot'
=> [
'clone'
,
'-f'
,
$config
,
'-Dq'
,
is
$result
->stdout ,
''
,
'no output'
;
is
$result
->stderr ,
''
,
'nothing on STDERR'
;
is
$result
->exit_code , 0 ,
'exit with 0'
;
t/05-fork.t view on Meta::CPAN
2122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
$mock
->mock(
create_fork
=>
sub
{{
ssl_url
=>
'yeahboi'
}} );
}
use
App::Cmd::Tester;
use
App::GitGot;
use
Path::Tiny;
my
$dir
= Test::BASE::create_tempdir_and_chdir();
my
$config
= path(
"$dir/gitgot"
);
file_not_exists_ok
$config
,
'config does not exist'
;
$ENV
{HOME} =
$dir
;
{
my
$result
= test_app(
'App::GitGot'
=> [
'fork'
,
'-f'
,
$config
]);
is
$result
->stdout ,
''
,
'nothing on STDOUT'
;
like
$result
->stderr ,
qr/ERROR: Need the URL of a repo to fork/
,
'need to give a URL'
;
is
$result
->exit_code , 1 ,
'exit with 1'
;
file_not_exists_ok
$config
,
'failed command does not create config'
;
}
{
my
$result
= test_app(
'App::GitGot'
=> [
'fork'
,
'-f'
,
$config
,
is
$result
->stdout ,
''
,
'nothing on STDOUT'
;
like
$result
->stderr ,
'need repo URL'
;
is
$result
->exit_code , 1 ,
'exit with 1'
;
file_not_exists_ok
$config
,
'failed command does not create config'
;
}
Test::BASE::create_github_identity_file();
{
is
$result
->stdout ,
''
,
'nothing on STDOUT'
;
like
$result
->stderr ,
'need to give a *github* URL'
;
is
$result
->exit_code , 1 ,
'exit with 1'
;
file_not_exists_ok
$config
,
'failed command does not create config'
;
}
{
my
$result
= test_app(
'App::GitGot'
=> [
'fork'
,
'-f'
,
$config
,
'--noclone'
,
'-q'
,
is
$result
->stdout ,
''
,
'no output'
;
is
$result
->stderr ,
''
,
'nothing on STDERR'
;
is
$result
->exit_code , 0 ,
'exit with 0'
;
( run in 0.279 second using v1.01-cache-2.11-cpan-bb97c1e446a )