Skip to content

Commit 3ea8d5c

Browse files
committed
Add --git-depth option
The option adds --depth option to all git clone commands
1 parent 89f9209 commit 3ea8d5c

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

Configure.pl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
'with-parrot=s', 'gen-parrot:s', 'parrot-config=s', 'parrot-option=s@',
3232
'with-moar=s', 'gen-moar:s', 'moar-option=s@',
3333
'make-install!', 'makefile-timing!',
34-
'git-protocol=s');
34+
'git-protocol=s',
35+
'git-depth=s',);
3536

3637
# Print help if it's requested
3738
if ($options{'help'}) {
@@ -318,6 +319,8 @@ sub print_help {
318319
--git-protocol={ssh,https,git}
319320
Protocol to use for git clone. Default: https
320321
--make-install Immediately run `MAKE install` after configuring
322+
--git-depth=<number>
323+
Use the --depth option for git clone with parameter number
321324
322325
Configure.pl also reads options from 'config.default' in the current directory.
323326
END

tools/lib/NQP/Configure.pm

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,15 @@ sub git_checkout {
211211
my $dir = shift;
212212
my $checkout = shift;
213213
my $pushurl = shift;
214+
my $git_depth = shift;
215+
my $depth = $git_depth ? '--depth=' . $git_depth : '';
214216
my $pwd = cwd();
215217

216218
# get an up-to-date repository
217219
if (! -d $dir) {
218-
system_or_die('git', 'clone', $repo, $dir);
220+
my @args = ('git', 'clone', $repo, $dir);
221+
push @args, $depth if $depth;
222+
system_or_die(@args);
219223
chdir($dir);
220224
system('git', 'config', 'remote.origin.pushurl', $pushurl)
221225
if defined $pushurl && $pushurl ne $repo;
@@ -317,6 +321,7 @@ sub gen_nqp {
317321
github_url($git_protocol, 'perl6', 'nqp'),
318322
'nqp', $nqp_want,
319323
github_url('ssh', 'perl6', 'nqp'),
324+
$options{'git-depth'},
320325
);
321326
}
322327

@@ -369,6 +374,7 @@ sub gen_parrot {
369374
github_url($git_protocol, 'parrot', 'parrot'),
370375
'parrot', $gen_parrot,
371376
github_url('ssh', 'parrot', 'parrot'),
377+
$options{'git-depth'},
372378
);
373379
$par_ok = $par_have eq $par_repo;
374380
}
@@ -377,6 +383,7 @@ sub gen_parrot {
377383
github_url($git_protocol, 'parrot', 'parrot'),
378384
'parrot', $par_want,
379385
github_url('ssh', 'parrot', 'parrot'),
386+
$options{'git-depth'},
380387
);
381388
}
382389

@@ -450,6 +457,7 @@ sub gen_moar {
450457
github_url($git_protocol, 'MoarVM', 'MoarVM'),
451458
'MoarVM', $gen_moar || $moar_want,
452459
github_url('ssh', 'MoarVM', 'MoarVM'),
460+
$options{'git-depth'},
453461
);
454462

455463
unless (cmp_rev($moar_repo, $moar_want) >= 0) {

0 commit comments

Comments
 (0)