]> xenbits.xensource.com Git - osstest.git/commitdiff
submodulefixup: Tell git cache [fetch=try]
authorIan Jackson <ian.jackson@eu.citrix.com>
Fri, 27 Jun 2014 10:42:31 +0000 (11:42 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Fri, 27 Jun 2014 16:52:51 +0000 (17:52 +0100)
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>
Osstest/BuildSupport.pm
Osstest/TestSupport.pm

index bd79b4b06a94c59b9912a91a4f553bad8e50c960..f3b8c630eaa0bceadd86abb0329d7cc8b5518b39 100644 (file)
@@ -117,7 +117,10 @@ sub submodulefixup ($$$$) {
                    $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 $!;
index 93c8fcf8501c193009b145aeefc391d60c26efbc..23ad106aec932f5a959dbad8ce9d18b81c4bee1a 100644 (file)
@@ -1026,12 +1026,16 @@ sub file_simple_write_contents ($$) {
 
 #---------- 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;
 }