Make git_massage_url take an optional %xopts list, currently with
only GitFetchBestEffort as a possible key.
Use that in submodulefixup, unconditionally. Often the submodule
update will work fine with an older version of the submodule, and if
the submodule we get is out of date then the submodule update will
fail anyway.
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
$log1->(" recording url=$u");
store_runvar($urv, $u);
}
- my $nu = $submod->{Url} = git_massage_url($u);
+ my $nu = $submod->{Url} =
+ git_massage_url($u, GitFetchBestEffort => 1);
+ # If we don't manage to fetch a version which contains the
+ # necessary commit(s), we will fail later.
$_ = "${l}${nu}\n";
}
print ::EO or die $!;
#---------- building, vcs's, etc. ----------
-sub git_massage_url ($) {
- my ($url) = @_;
+sub git_massage_url ($;@) {
+ my ($url, %xopts) = @_;
+ # Supports $xopts{GitFetchBestEffort}
if ($url =~ m,^(git|https?)://, && $c{GitCacheProxy} &&
substr($url,0,length($c{GitCacheProxy})) ne $c{GitCacheProxy}) {
$url = $c{GitCacheProxy}.$url;
+ if ($xopts{GitFetchBestEffort}) {
+ $url .= '%20[fetch=try]';
+ }
}
return $url;
}