From: Ian Jackson Date: Sat, 16 Jun 2018 20:32:11 +0000 (+0100) Subject: git-debrebase: make_patches; Move get_differs into cmd_... X-Git-Tag: archive/debian/5.0~33 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=8b38c204c268e0e862036c273a6298ccc9ea46fd;p=dgit.git git-debrebase: make_patches; Move get_differs into cmd_... We want to make the error handling dependent on options, etc. Moving the differs analysis into cmd_make_patches avoids having a complex calling convention for make_patches. No functional change. Signed-off-by: Ian Jackson --- diff --git a/git-debrebase b/git-debrebase index 634ed763..3cab3ad8 100755 --- a/git-debrebase +++ b/git-debrebase @@ -1501,28 +1501,25 @@ sub make_patches ($) { '[git-debrebase: export and commit patches]', ]; }; - my $d = get_differs $head, $out; - if ($d == 0) { - return undef; # nothing to do - } elsif ($d == D_PAT_ADD) { - return $out; # OK - } else { - fail "Patch export produced patch amendments". - " (abandoned output commit $out).". - " Try laundering first."; - } + return $out; } sub cmd_make_patches () { badusage "no arguments allowed" if @ARGV; my $old_head = get_head(); my $new = make_patches $old_head; - snags_maybe_bail(); - if (!$new) { + my $d = get_differs $old_head, $new; + if ($d == 0) { fail "No (more) patches to export." unless $opt_noop_ok; return; + } elsif ($d == D_PAT_ADD) { + snags_maybe_bail(); + update_head_checkout $old_head, $new, 'make-patches'; + } else { + fail "Patch export produced patch amendments". + " (abandoned output commit $new).". + " Try laundering first."; } - update_head_checkout $old_head, $new, 'make-patches'; } sub cmd_convert_from_gbp () {