chiark / gitweb /
Split brain: Use `gbp pq' (which exists) not `gbp-pq' (which doesn't)
[dgit.git] / dgit
diff --git a/dgit b/dgit
index 3f637f133bf9b2a7bd891f6e0c6e271f167e9c91..455b375e96e13a7c0f790514e8169fe75ab39490 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -86,7 +86,7 @@ our (@dpkgbuildpackage) = qw(dpkg-buildpackage -i\.git/ -I.git);
 our (@dpkgsource) = qw(dpkg-source -i\.git/ -I.git);
 our (@dpkggenchanges) = qw(dpkg-genchanges);
 our (@mergechanges) = qw(mergechanges -f);
-our (@gbppq) = qw(gbp-pq);
+our (@gbp) = qw(gbp);
 our (@changesopts) = ('');
 
 our %opts_opt_map = ('dget' => \@dget, # accept for compatibility
@@ -2578,14 +2578,25 @@ sub quiltify_splitbrain ($$$$$$) {
     local $ENV{GIT_COMMITTER_NAME} =  $authline[0];
     local $ENV{GIT_COMMITTER_EMAIL} = $authline[1];
     local $ENV{GIT_COMMITTER_DATE} =  $authline[2];
+       
     if ($quilt_mode =~ m/gbp|unapplied/ &&
-       ($diffbits->{O2A} & 01) && # some patches
-       !($diffbits->{H2O} & 01)) { # but HEAD is like orig
+       ($diffbits->{H2O} & 01)) {
+       my $msg =
+ "--quilt=$quilt_mode specified, implying patches-unapplied git tree\n".
+ " but git tree differs from orig in upstream files.";
+       if (!stat_exists "debian/patches") {
+           $msg .=
+ "\n ... debian/patches is missing; perhaps this is a patch queue branch?";
+       }  
+       fail $msg;
+    }
+    if ($quilt_mode =~ m/gbp|unapplied/ &&
+       ($diffbits->{O2A} & 01)) { # some patches
        quiltify_splitbrain_needed();
-       progress "creating patches-applied version using gbp-pq";
+       progress "creating patches-applied version using gbp pq";
        open STDOUT, ">/dev/null" or die $!;
-       runcmd shell_cmd 'exec >/dev/null', @gbppq, qw(import);
-       # gbp-pq import creates a fresh branch; push back to dgit-view
+       runcmd shell_cmd 'exec >/dev/null', @gbp, qw(pq import);
+       # gbp pq import creates a fresh branch; push back to dgit-view
        runcmd @git, qw(update-ref refs/heads/dgit-view HEAD);
        runcmd @git, qw(checkout -q dgit-view);
     }
@@ -3052,6 +3063,7 @@ END
        # we look for an entry whose message is the key for the cache lookup
        my @cachekey = (qw(dgit), $our_version);
        push @cachekey, $upstreamversion;
+       push @cachekey, $quilt_mode;
        push @cachekey, $headref;
 
        push @cachekey, hashfile('fake.dsc');