From 03979a8b3d7b3bec886f37d1c8358bdc79bc97c9 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 19 Aug 2018 22:45:49 +0100 Subject: git-debrebase: Break out begin_convert_from & complete_... $gdrlastinfo is undef for now, and will be used in a moment. No functional change. Signed-off-by: Ian Jackson --- git-debrebase | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/git-debrebase b/git-debrebase index 8e347f1..2e0882d 100755 --- a/git-debrebase +++ b/git-debrebase @@ -2409,6 +2409,18 @@ sub check_series_has_all_patches ($) { } } +sub begin_convert_from () { + my $head = get_head(); + return ($head, undef); +} + +sub complete_convert_from ($$$$) { + my ($old_head, $new_head, $gi, $mrest) = @_; + ffq_check $new_head; + snags_maybe_bail(); + update_head_checkout $old_head, $new_head, $mrest; +} + sub cmd_convert_from_gbp () { badusage "want only 1 optional argument, the upstream git commitish" unless @ARGV<=1; @@ -2423,7 +2435,7 @@ sub cmd_convert_from_gbp () { my $upstream = resolve_upstream_version($upstream_spec, $upstream_version); - my $old_head = get_head(); + my ($old_head, $gdrlastinfo) = begin_convert_from(); my $upsdiff = get_differs $upstream, $old_head; if ($upsdiff & D_UPS) { @@ -2537,9 +2549,7 @@ END } }; - ffq_check $work; - snags_maybe_bail(); - update_head_checkout $old_head, $work, 'convert-from-gbp'; + complete_convert_from $old_head, $work, $gdrlastinfo, 'convert-from-gbp'; print <{Source}; - ffq_check $result->{Result}; - snags_maybe_bail(); - update_head_checkout $head, $result->{Result}, + complete_convert_from $head, $result->{Result}, $gdrlastinfo, 'convert-from-dgit-view'; } -- cgit v1.2.3