From: Ian Jackson Date: Sat, 10 Feb 2018 14:15:09 +0000 (+0000) Subject: git-debrebase: bugfixes X-Git-Tag: archive/debian/5.0~261 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=commitdiff_plain;h=850b9cacb62d6009cb503cbec266174fe92a90a7 git-debrebase: bugfixes Signed-off-by: Ian Jackson --- diff --git a/git-debrebase b/git-debrebase index 50f5e167..88118aa4 100755 --- a/git-debrebase +++ b/git-debrebase @@ -162,7 +162,7 @@ sub get_differs ($$) { my @cmd = (@git, qw(diff-tree -z --no-renames)); push @cmd, @$opts; push @cmd, "$_:" foreach $x, $y; - push @cmd, @$limits; + push @cmd, '--', @$limits; my $diffs = cmdoutput @cmd; foreach (split /\0/, $diffs) { $fn->(); } }; @@ -770,9 +770,8 @@ sub update_head ($$$) { sub update_head_checkout ($$$) { my ($old, $new, $mrest) = @_; - my $symref = git_get_symref(); - runcmd @git, qw(checkout), $new, qw(.); update_head $old, $new, $mrest; + runcmd @git, qw(reset --hard); } sub update_head_postlaunder ($$$) { @@ -1020,13 +1019,39 @@ sub cmd_gbp2debrebase () { if ((git_cat_file "$upstream:debian")[0] ne 'missing') { fproblem "upstream ($upstream) contains debian/ directory"; } - die; + + fproblems_maybe_bail(); + + my $work; fresh_workarea(); in_workarea sub { - runcmd @git, qw(checkout -b work), $old_head; - + runcmd @git, qw(checkout -q -b gdr-internal), $old_head; + # make a branch out of the patch queue - we'll want this in a mo + runcmd qw(gbp pq import); + # strip the patches out + runcmd @git, qw(checkout -q gdr-internal~0); + rm_subdir_cached 'debian/patches'; + $work = make_commit ['HEAD'], [ + 'git-debrebase import: drop patch queue', + 'Delete debian/patches, as part of converting to git-debrebase format.', + '[git-debrebase gbp2debrebase drop-patches]' + ]; + # make the breakwater pseudomerge + # the tree is already exactly right + $work = make_commit [$work, $upstream], [ + 'git-debrebase import: declare upstream', + 'First breakwater merge.', + '[git-debrebase declare-upstream breakwater]' + ]; + + # rebase the patch queue onto the new breakwater + runcmd @git, qw(reset --quiet --hard patch-queue/gdr-internal); + runcmd @git, qw(rebase --quiet --onto), $work, qw(gdr-internal); + $work = get_head(); }; + + update_head_checkout $old_head, $work, 'gbp2debrebase'; } sub cmd_downstream_rebase_launder_v0 () {