summaryrefslogtreecommitdiff
path: root/git-debrebase
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2018-06-16 21:32:11 +0100
committerIan Jackson <ijackson@chiark.greenend.org.uk>2018-06-16 23:25:50 +0100
commit8b38c204c268e0e862036c273a6298ccc9ea46fd (patch)
treed9daf1dac8bd225854677b2437b7977c67bea929 /git-debrebase
parentb2576526b99a3dd484f33782c5f20d9d42db1302 (diff)
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 <ijackson@chiark.greenend.org.uk>
Diffstat (limited to 'git-debrebase')
-rwxr-xr-xgit-debrebase23
1 files changed, 10 insertions, 13 deletions
diff --git a/git-debrebase b/git-debrebase
index 634ed76..3cab3ad 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 () {