chiark / gitweb /
git-debrebse: merge handling: Handle absence of patches via $any
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 25 Aug 2018 12:36:35 +0000 (13:36 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 25 Aug 2018 12:36:35 +0000 (13:36 +0100)
This saves testing for $seriesfile existence and makes the code
slightly less tangled.

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

index 10dadc5..4756748 100755 (executable)
@@ -603,9 +603,10 @@ sub merge_series ($$$;@) {
        playtree_setup();
        foreach my $q ($base_q, reverse @input_qs) {
            my $s = $q->{MR}{S};
-           gbp_pq_export "p-$s", $q->{SeriesBase}, $q->{SeriesTip};
+           my $any = gbp_pq_export "p-$s", $q->{SeriesBase}, $q->{SeriesTip};
            my @earlier;
-           if (open S, $seriesfile) {
+           if ($any) {
+               open S, $seriesfile or die "$seriesfile $!";
                while (my $patch = <S>) {
                    chomp $patch or die $!;
                    $prereq{$patch} //= {};
@@ -617,8 +618,6 @@ sub merge_series ($$$;@) {
                }
                S->error and die "$seriesfile $!";
                close S;
-           } else {
-               die "$seriesfile $!" unless $!==ENOENT;
            }
            read_tree_upstream $newbase, 1;
            my $pec = make_commit [ grep { defined } $base_q->{MR}{PEC} ], [