#
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'