X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=git-debrebase;h=4756748adaf58b9853166982d16763a452a5ad97;hb=7bd28223f931fa3f36760e73c4e32673ca7f3cbe;hp=353b405ffa9cbec39ebefd2d001614da02426bf1;hpb=7b8e6ff1d7c697ec131f6ab9106583c8a28d3e7f;p=dgit.git diff --git a/git-debrebase b/git-debrebase index 353b405f..4756748a 100755 --- a/git-debrebase +++ b/git-debrebase @@ -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 = ) { 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} ], [ @@ -1081,9 +1080,8 @@ sub keycommits ($;$$$$$) { my ($head, $furniture, $unclean, $trouble, $fatal, $claimed_bw) = @_; # => ($anchor, $breakwater) - # $unclean->("unclean-$tagsfx", $msg, $cl) # $furniture->("unclean-$tagsfx", $msg, $cl) - # $dgitimport->("unclean-$tagsfx", $msg, $cl)) + # $unclean->("unclean-$tagsfx", $msg, $cl) # is callled for each situation or commit that # wouldn't be found in a laundered branch # $furniture is for furniture commits such as might be found on an @@ -2408,12 +2406,17 @@ sub make_patches_staged ($) { sub make_patches ($) { my ($head) = @_; keycommits $head, 0, \&snag; - make_patches_staged $head; + my $any = make_patches_staged $head; my $out; in_workarea sub { - my $ptree = cmdoutput @git, qw(write-tree --prefix=debian/patches/); + my $ptree = !$any ? undef : + cmdoutput @git, qw(write-tree --prefix=debian/patches/); runcmd @git, qw(read-tree), $head; - read_tree_subdir 'debian/patches', $ptree; + if ($ptree) { + read_tree_subdir 'debian/patches', $ptree; + } else { + rm_subdir_cached 'debian/patches'; + } $out = make_commit [$head], [ 'Commit patch queue (exported by git-debrebase)', '[git-debrebase make-patches: export and commit patches]', @@ -2635,13 +2638,18 @@ sub cmd_convert_to_gbp () { my (undef, undef, undef, $ffq, $gdrlast) = ffq_prev_branchinfo(); my ($anchor, $breakwater) = keycommits $head, 0; my $out = $breakwater; - make_patches_staged $head; - in_workarea sub { - $out = make_commit [$out], [ - 'Commit patch queue (converted from git-debrebase format)', - '[git-debrebase convert-to-gbp: commit patches]', - ]; - }; + my $any = make_patches_staged $head; + if ($any) { + in_workarea sub { + $out = make_commit [$out], [ + 'Commit patch queue (converted from git-debrebase format)', + '[git-debrebase convert-to-gbp: commit patches]', + ]; + }; + } else { + # in this case, it can be fast forward + $out = $head; + } if (defined $ffq) { push @deferred_updates, "delete $ffq"; push @deferred_updates, "delete $gdrlast";