From 9fe0302b9d3652f4423ab12a4db18145c6b7b13c Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 22 Apr 2018 23:38:00 +0100 Subject: [PATCH] git-debrebase: Break out make_patches_staged (nfc) Signed-off-by: Ian Jackson --- git-debrebase | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/git-debrebase b/git-debrebase index ce348e29..52a06d37 100755 --- a/git-debrebase +++ b/git-debrebase @@ -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]', -- 2.30.2