chiark / gitweb /
git-debrebase: merge: Call merge_failed in merge_series
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 11 Aug 2018 17:56:18 +0000 (18:56 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 11 Aug 2018 19:11:09 +0000 (20:11 +0100)
Introduce $attempt_cmd for this purpose.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
git-debrebase

index c3bd7ff..464a14c 100755 (executable)
@@ -439,6 +439,15 @@ sub merge_series ($$$;@) {
 
     my $mwrecknote = sub { &mwrecknote($wrecknotes, @_); };
 
+    my $attempt_cmd = sub {
+       debugcmd '+', @_;
+       $!=0; $?=-1;
+       if (system @_) {
+           failedcmd_report_cmd undef, @_;
+           merge_failed $wrecknotes, failedcmd_waitstatus();
+       }
+    };
+
     local $workarea = fresh_playground "$playprefix/merge";
     my $seriesfile = "debian/patches/series";
     in_workarea sub {
@@ -498,11 +507,8 @@ sub merge_series ($$$;@) {
        runcmd @git, qw(checkout -q -b merge);
        printdebug "merge_series merging...\n";
        my @mergecmd = (@git, qw(merge --quiet --no-edit), "p-1");
-       debugcmd '+', @mergecmd;
-       $!=0; $?=-1;
-       if (system @mergecmd) {
-           failedcmd @mergecmd;
-       }
+
+       $attempt_cmd->(@mergecmd);
 
        printdebug "merge_series merge ok, series...\n";
        # We need to construct a new series file
@@ -578,7 +584,8 @@ sub merge_series ($$$;@) {
        $mwrecknote->('merged-patchqueue', git_rev_parse 'HEAD');
 
        printdebug "merge_series series gbp pq import\n";
-       runcmd qw(gbp pq import);
+
+       $attempt_cmd->(qw(gbp pq import));
 
        # OK now we are on patch-queue/merge, and we need to rebase
        # onto the intended parent and drop the patches from each one