chiark / gitweb /
quilt fixup: Break out quilt_fixup_mkwork (nfc)
[dgit.git] / dgit
diff --git a/dgit b/dgit
index ce858ab98057bd770095ecf2b16b8e322e126922..4675944fc3c30a4400c0ea741f8f8b79fa9c9919 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -2744,6 +2744,39 @@ sub build_maybe_quilt_fixup () {
 
     check_for_vendor_patches();
 
+    my $clogp = parsechangelog();
+    my $headref = git_rev_parse('HEAD');
+
+    prep_ud();
+    changedir $ud;
+
+    my $upstreamversion=$version;
+    $upstreamversion =~ s/-[^-]*$//;
+
+    if ($fopts->{'single-debian-patch'}) {
+       #quilt_fixup_singlepatch($clogp, $headref, $upstreamversion);
+       die;
+    } else {
+       quilt_fixup_multipatch($clogp, $headref, $upstreamversion);
+    }
+
+    changedir '../../../..';
+    runcmd_ordryrun_local
+        @git, qw(pull --ff-only -q .git/dgit/unpack/work master);
+}
+
+sub quilt_fixup_mkwork ($) {
+    my ($headref) = @_;
+
+    mkdir "work" or die $!;
+    changedir "work";
+    mktree_in_ud_here();
+    runcmd @git, qw(reset --hard), $headref;
+}
+
+sub quilt_fixup_multipatch ($$$) {
+    my ($clogp, $headref, $upstreamversion) = @_;
+
     # Our objective is:
     #  - honour any existing .pc in case it has any strangeness
     #  - determine the git commit corresponding to the tip of
@@ -2788,15 +2821,6 @@ sub build_maybe_quilt_fixup () {
     #     5. If we had a .pc in-tree, delete it, and git-commit
     #     6. Back in the main tree, fast forward to the new HEAD
 
-    my $clogp = parsechangelog();
-    my $headref = git_rev_parse('HEAD');
-
-    prep_ud();
-    changedir $ud;
-
-    my $upstreamversion=$version;
-    $upstreamversion =~ s/-[^-]*$//;
-
     my $fakeversion="$upstreamversion-~~DGITFAKE";
 
     my $fakedsc=new IO::File 'fake.dsc', '>' or die $!;
@@ -2844,10 +2868,7 @@ END
     my $fakexdir= $package.'-'.(stripepoch $upstreamversion);
     rename $fakexdir, "fake" or die "$fakexdir $!";
 
-    mkdir "work" or die $!;
-    changedir "work";
-    mktree_in_ud_here();
-    runcmd @git, qw(reset --hard), $headref;
+    quilt_fixup_mkwork($headref);
 
     my $mustdeletepc=0;
     if (stat_exists ".pc") {
@@ -2872,10 +2893,6 @@ END
         runcmd @git, qw(rm -rqf .pc);
         commit_admin "Commit removal of .pc (quilt series tracking data)";
     }
-
-    changedir '../../../..';
-    runcmd_ordryrun_local
-        @git, qw(pull --ff-only -q .git/dgit/unpack/work master);
 }
 
 sub quilt_fixup_editor () {