From 128475f6273172b482ec6d5142a7a51f00833c3f Mon Sep 17 00:00:00 2001 From: "Heiko Schlittermann (HS12-RIPE)" Date: Sun, 6 Nov 2016 00:13:55 +0100 Subject: [PATCH] Do not die if the auto-update does not work --- run_branches | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/run_branches b/run_branches index bf377fb..d45024d 100755 --- a/run_branches +++ b/run_branches @@ -85,23 +85,26 @@ if (not exists $EximBuild::Conf{auto_update} or $EximBuild::Conf{auto_update}) die "$0: auto-update not possible: need write permissions in @{[cwd]}\n" if not -w '.'; + # Get information about our remote and calculate the chance for a + # successfull auto-updat. Based on: # http://stackoverflow.com/questions/3258243/check-if-pull-needed-in-git system("git fetch $remote") == 0 or die $? >> 8; my ($upstream, $local, $base) = qx'git rev-parse ...@{upstream}'; die $? >> 8 if $?; $base =~ s/^\^//; if ($upstream ne $local) { - die "$0: the merge base is not local anymore. Refusing to `git pull`\n" - if $base ne $local; - say "Doing git pull ..." if $verbose; - - # if we're the merge base, the ff-only should workkkkkk - system 'git pull --ff-only' == 0 or die $? >> 8; - say "$0: re-execute after update"; - chdir $CALLED{cwd} or die "$0: Can't chdir to $CALLED{cwd}: $!\n"; - exec $CALLED{argv0}, @{$CALLED{argv}}; - die "Can't re-exec\n"; + if ($base ne $local) { + warn "$0: the merge base is not local anymore. Refusing to `git pull`\n" + } + else { + # if we're the merge base, the ff-only should work + system 'git pull --ff-only' == 0 or die $? >> 8; + say "$0: re-execute after update"; + chdir $CALLED{cwd} or die "$0: Can't chdir to $CALLED{cwd}: $!\n"; + exec $CALLED{argv0}, @{$CALLED{argv}}; + die "Can't re-exec\n"; + } } } -- 2.30.2