X-Git-Url: https://git.exim.org/buildfarm-client.git/blobdiff_plain/34e7f3555072b6ac03fca1d9715909dc093f8a36..3769c7ccb6a7f0089bb44c0e061a321aa2f4815e:/run_branches?ds=sidebyside diff --git a/run_branches b/run_branches index 9e267af..20f3790 100755 --- a/run_branches +++ b/run_branches @@ -72,6 +72,25 @@ $branch = 'global'; # require $buildconf; +# Check if auto-update is wanted and possible +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 '.'; + # http://stackoverflow.com/questions/3258243/check-if-pull-needed-in-git + system('git remote update') == 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; + + # if we're the merge base, the ff-only should workkkkkk + system 'git pull --ff-only' + } +} + unless ( ( ref $EximBuild::conf{branches_to_build} eq 'ARRAY'