From 79bc02ccafe81cf9487c4b88a241ebe1343b6cca Mon Sep 17 00:00:00 2001 From: Hauke D Date: Mon, 13 Aug 2018 20:55:55 +0200 Subject: [PATCH] Allow build.pl's "git fetch" to fail cleanly For example, in case the user doesn't have network connectivity. --- build/build.pl | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/build/build.pl b/build/build.pl index 931669c..e302cd3 100755 --- a/build/build.pl +++ b/build/build.pl @@ -110,9 +110,17 @@ if (!-e $C{PERLSRCDIR}) { die "something went wrong with git clone" unless -d $C{PERLSRCDIR}; $needs_reconfig=1; } -{ +GITSTUFF: { my $d = pushd($C{PERLSRCDIR}); - git 'fetch'; + eval { + git 'fetch'; + 1 } or do { + warn $@; + # Maybe we don't have network connectivity + if (prompt("Whoops, 'git fetch' failed. Continue anyway? [Yn]","y")=~/^\s*y/i) + { last GITSTUFF } + else { die "git fetch failed, aborting" } + }; my $myhead = git 'log', '-1', '--format=%h', $C{PERL_BRANCH}, {chomp=>1,show_cmd=>$VERBOSE}; my $remhead = git 'log', '-1', '--format=%h', 'origin/'.$C{PERL_BRANCH}, {chomp=>1,show_cmd=>$VERBOSE}; say STDERR "# Local branch is at $myhead, remote is $remhead";