From 60bb7492cc692cabb60bb9d057dcc83b79cc62f8 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 18 Feb 2018 13:20:07 +0000 Subject: git-debrebase: stitch: ff when possible Signed-off-by: Ian Jackson --- git-debrebase | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/git-debrebase b/git-debrebase index 93bf46b..c08af65 100755 --- a/git-debrebase +++ b/git-debrebase @@ -1199,8 +1199,20 @@ sub cmd_stitch () { if (!$prev) { fail "No ffq-prev to stitch." unless $opt_noop_ok; } - fresh_workarea(); my $old_head = get_head(); + if (is_fast_fwd $old_head, $prev) { + my $differs = get_differs $old_head, $prev; + unless ($differs & ~D_PAT_ADD) { + # ffq-prev is ahead of us, and the only tree changes it has + # are possibly addition of things in debian/patches/. + # Just wind forwards rather than making a pointless pseudomerge. + update_head_checkout $old_head, $prev, + "debrebase: stitch (fast forward)"; + runcmd @git, qw(update-ref -d), $ffq_prev; # should be atomic + return; + } + } + fresh_workarea(); my $new_head = make_commit [ $old_head, $ffq_prev ], [ 'Declare fast forward / record previous work', "[git-debrebase pseudomerge: stitch$prose]", -- cgit v1.2.3