chiark / gitweb /
quilt innards: Change calling convention for quilt_check_splitbrain_cache
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 16 Jul 2016 16:59:07 +0000 (17:59 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 17 Jul 2016 12:46:14 +0000 (13:46 +0100)
dgit

diff --git a/dgit b/dgit
index 835366eaed8a5efd42878ce52c261f73e56397b9..1e6be23d9ae21e9aac8d0018cf923ba4b4bb747f 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -2994,15 +2994,10 @@ END
 
 sub quilt_check_splitbrain_cache ($$) {
     my ($headref, $upstreamversion) = @_;
-    # Checks to see if we are in (potentially) split brain mode.
-    # If so, computes the cache key and looks in the cache.
-    # If split brain is not applicable, returns (undef,0).
-    # Otherwise returns ($cachekey,HIT) where
-    # HIT=0: miss; HIT=1: hit, needs different commit; HIT=2: same commit OK
-
-    quilt_make_fake_dsc($upstreamversion);
-
-    return (undef,0) unless quiltmode_splitbrain();
+    # Called only if we are in (potentially) split brain mode.
+    # Called in $ud.
+    # Computes the cache key and looks in the cache.
+    # Returns ($dgit_view_commitid, $cachekey) or (undef, $cachekey)
 
     my $splitbrain_cachekey;
     
@@ -3052,16 +3047,16 @@ sub quilt_check_splitbrain_cache ($$) {
            progress "dgit view: found cached (commit id $cachehit)";
            runcmd @git, qw(checkout -q -b dgit-view), $cachehit;
            $split_brain = 1;
-           return ($splitbrain_cachekey, 1);
+           return ($cachehit, $splitbrain_cachekey);
        }
        progress "dgit view: found cached, no changes required";
-       return ($splitbrain_cachekey, 2);
+       return ($headref, $splitbrain_cachekey);
     }
     die $! if GC->error;
     failedcmd unless close GC;
 
     printdebug "splitbrain cache miss\n";
-    return ($splitbrain_cachekey, 0);
+    return (undef, $splitbrain_cachekey);
 }
 
 sub quilt_fixup_multipatch ($$$) {
@@ -3138,10 +3133,16 @@ sub quilt_fixup_multipatch ($$$) {
     # afterwards with dpkg-source --before-build.  That lets us save a
     # tree object corresponding to .origs.
 
-    my ($splitbrain_cachekey,$cachehit) =
-       quilt_check_splitbrain_cache($headref, $upstreamversion);
+    my $splitbrain_cachekey;
+
+    quilt_make_fake_dsc($upstreamversion);
 
-    return if $splitbrain_cachekey && $cachehit;
+    if (quiltmode_splitbrain()) {
+       my $cachehit;
+       ($cachehit, $splitbrain_cachekey) =
+           quilt_check_splitbrain_cache($headref, $upstreamversion);
+       return if $cachehit;
+    }
 
     runcmd qw(sh -ec),
         'exec dpkg-source --no-check --skip-patches -x fake.dsc >/dev/null';