diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2018-02-18 13:20:07 +0000 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2018-06-16 16:06:59 +0100 |
commit | 60bb7492cc692cabb60bb9d057dcc83b79cc62f8 (patch) | |
tree | f5a013ac2b4de3e5f23b558bca31829a6add3c4b | |
parent | a90cd66b7e31da80fc78134d39c143b3fa0106c8 (diff) |
git-debrebase: stitch: ff when possible
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
-rwxr-xr-x | git-debrebase | 14 |
1 files changed, 13 insertions, 1 deletions
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]", |