diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2018-06-16 20:41:23 +0100 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2018-06-16 22:40:14 +0100 |
commit | 39e84f67e266f87368e4bce44d4b4b469ef7165a (patch) | |
tree | 78a64b11e3a9947e7400178ab184aa3043697fd5 /git-debrebase | |
parent | d0f938a6ab692ed24009b2f1c101e6e91a242b7d (diff) |
git-debrebase: keycommits: Now $fatal hook
This allows a caller to avoid having keycommits crash on
unrecognisable stuff. This will be used in a moment.
No functional change, because the default implementation calls fail
the same way it did before.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Diffstat (limited to 'git-debrebase')
-rwxr-xr-x | git-debrebase | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/git-debrebase b/git-debrebase index 9a356df..c180a29 100755 --- a/git-debrebase +++ b/git-debrebase @@ -538,8 +538,8 @@ sub classify ($) { return $unknown->("complex merge"); } -sub keycommits ($;$$$) { - my ($head, $furniture, $unclean, $trouble) = @_; +sub keycommits ($;$$$$) { + my ($head, $furniture, $unclean, $trouble, $fatal) = @_; # => ($anchor, $breakwater) # $unclean->("unclean-$tagsfx", $msg, $cl) @@ -552,6 +552,8 @@ sub keycommits ($;$$$) { # $trouble is for things whnich prevent the return of # anchor and breakwater information; if that is ignored, # then keycommits returns (undef, undef) instead. + # $fatal is for unprocessable commits, and should normally cause + # a failure. If ignored, agaion, (undef, undef) is returned. # # If a callback is undef, fail is called instead. # If a callback is defined but false, the situation is ignored. @@ -562,6 +564,7 @@ sub keycommits ($;$$$) { my ($anchor, $breakwater); my $clogonly; my $cl; + $fatal //= sub { fail $_[2]; }; my $x = sub { my ($cb, $tagsfx, $why) = @_; my $m = "branch needs laundering (run git-debrebase): $why"; @@ -606,7 +609,10 @@ sub keycommits ($;$$$) { "found dgit dsc import ($head)"); return (undef,undef); } else { - fail "found unprocessable commit, cannot cope: $head; $cl->{Why}"; + $x->($fatal, 'unprocessable', + "found unprocessable commit, cannot cope: $head; $cl->{Why}" + ); + return (undef,undef); } $head = $cl->{Parents}[0]{CommitId}; } |