chiark / gitweb /
git-debrebase: Break out make_patches_staged (nfc)
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 22 Apr 2018 22:38:00 +0000 (23:38 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 16 Jun 2018 21:40:13 +0000 (22:40 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
git-debrebase

index ce348e2..52a06d3 100755 (executable)
@@ -1348,6 +1348,17 @@ sub cmd_conclude () {
     do_stitch 'quick';
 }
 
+sub make_patches_staged ($$) {
+    my ($bw, $head) = @_;
+    fresh_workarea();
+    in_workarea sub {
+       runcmd @git, qw(checkout -q -b bw), $bw;
+       runcmd @git, qw(checkout -q -b patch-queue/bw), $head;
+       runcmd qw(gbp pq export);
+       runcmd @git, qw(add debian/patches);
+    };
+}
+
 sub cmd_convert_from_gbp () {
     badusage "needs 1 optional argument, the upstream git rev"
        unless @ARGV<=1;
@@ -1422,13 +1433,9 @@ sub cmd_convert_to_gbp () {
     my $head = get_head();
     my (undef, undef, undef, $ffq, $gdrlast) = ffq_prev_branchinfo();
     my ($anchor, $bw) = keycommits $head, 0;
-    fresh_workarea();
     my $out;
+    make_patches_staged $bw, $head;
     in_workarea sub {
-       runcmd @git, qw(checkout -q -b bw), $bw;
-       runcmd @git, qw(checkout -q -b patch-queue/bw), $head;
-       runcmd qw(gbp pq export);
-       runcmd @git, qw(add debian/patches);
        $out = make_commit ['HEAD'], [
             'Commit patch queue (converted from git-debrebase format)',
             '[git-debrebase convert-to-gbp: commit patches]',