X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=git-debrebase;h=10dadc55cab4f731768601f65e47a409ff132e69;hb=11427376f5f4fef68225cebebda04f78faad5b01;hp=353b405ffa9cbec39ebefd2d001614da02426bf1;hpb=7b8e6ff1d7c697ec131f6ab9106583c8a28d3e7f;p=dgit.git diff --git a/git-debrebase b/git-debrebase index 353b405f..10dadc55 100755 --- a/git-debrebase +++ b/git-debrebase @@ -1081,9 +1081,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 +2407,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 +2639,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";