diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2018-08-10 12:33:10 +0100 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2018-08-10 12:35:13 +0100 |
commit | cf4848f57b34bc2918526e8195c9ec730b11b18a (patch) | |
tree | 80f296dbb587e0986a2745b3dafd35f3830a5f6a /git-debrebase | |
parent | 1d40cf793435df8be77fd789ada3faa18c480f8e (diff) |
git-debrebase: Break out gbp_pq_export (nfc)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Diffstat (limited to 'git-debrebase')
-rwxr-xr-x | git-debrebase | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/git-debrebase b/git-debrebase index 0d3162f..f56ec32 100755 --- a/git-debrebase +++ b/git-debrebase @@ -310,6 +310,22 @@ sub any_snags () { return $snags_forced || $snags_tripped; } +sub gbp_pq_export ($$$) { + my ($bname, $base, $tip) = @_; + # must be run in a workarea. $bname and patch-queue/$bname + # ought not to exist. Leaves you on patch-queue/$bname with + # the patches staged but not committed. + runcmd @git, qw(checkout -q -b), $bname, $base; + runcmd @git, qw(checkout -q -b), "patch-queue/$bname", $tip; + my @gbp_cmd = (qw(gbp pq export)); + my $r = system shell_cmd 'exec >../gbp-pq-err 2>&1', @gbp_cmd; + if ($r) { + { local ($!,$?); copy('../gbp-pq-err', \*STDERR); } + failedcmd @gbp_cmd; + } + runcmd @git, qw(add -f debian/patches); +} + # classify returns an info hash like this # CommitId => $objid # Hdr => # commit headers, including 1 final newline @@ -1618,15 +1634,7 @@ sub make_patches_staged ($) { my ($secret_head, $secret_bw, $last_anchor) = walk $head; fresh_workarea(); in_workarea sub { - runcmd @git, qw(checkout -q -b bw), $secret_bw; - runcmd @git, qw(checkout -q -b patch-queue/bw), $secret_head; - my @gbp_cmd = (qw(gbp pq export)); - my $r = system shell_cmd 'exec >../gbp-pq-err 2>&1', @gbp_cmd; - if ($r) { - { local ($!,$?); copy('../gbp-pq-err', \*STDERR); } - failedcmd @gbp_cmd; - } - runcmd @git, qw(add -f debian/patches); + gbp_pq_export 'bw', $secret_bw, $secret_head; }; } |