From 27aec8c7cfd2cfd315e321d9ac335872665bcfc0 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 7 Jul 2018 00:13:02 +0100 Subject: git-debrebase: keycommits: Callbacks get separate $mainwhy Separate out the extra contextual info, naming the hash of the commit being complained about, into a separate argument to $x->(). This allows us to pass the message without that as an additional argument to the callbacks. This way we can still pass \&snag as a callback but other callers can do something more sophisticated involving $cl. No functional change for any existing callers. Signed-off-by: Ian Jackson --- git-debrebase | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/git-debrebase b/git-debrebase index 04befff..292471d 100755 --- a/git-debrebase +++ b/git-debrebase @@ -568,11 +568,12 @@ sub keycommits ($;$$$$) { my $cl; $fatal //= sub { fail $_[2]; }; my $x = sub { - my ($cb, $tagsfx, $why) = @_; + my ($cb, $tagsfx, $mainwhy, $xwhy) = @_; + my $why = $mainwhy.$xwhy; my $m = "branch needs laundering (run git-debrebase): $why"; fail $m unless defined $cb; return unless $cb; - $cb->("unclean-$tagsfx", $why, $cl); + $cb->("unclean-$tagsfx", $why, $cl, $mainwhy); }; for (;;) { $cl = classify $head; @@ -593,27 +594,27 @@ sub keycommits ($;$$$$) { last; } elsif ($ty eq 'Upstream') { $x->($unclean, 'ordering', - "packaging change ($breakwater) follows upstream change (eg $head)") + "packaging change ($breakwater) follows upstream change"," (eg $head)") if defined $breakwater; $clogonly = undef; $breakwater = undef; } elsif ($ty eq 'Mixed') { $x->($unclean, 'mixed', - "found mixed upstream/packaging commit ($head)"); + "found mixed upstream/packaging commit"," ($head)"); $clogonly = undef; $breakwater = undef; } elsif ($ty eq 'Pseudomerge' or $ty eq 'AddPatches') { $x->($furniture, (lc $ty), - "found interchange bureaucracy commit ($ty, $head)"); + "found interchange bureaucracy commit ($ty)"," ($head)"); } elsif ($ty eq 'DgitImportUnpatched') { $x->($trouble, 'dgitimport', "found dgit dsc import ($head)"); return (undef,undef); } else { $x->($fatal, 'unprocessable', - "found unprocessable commit, cannot cope: $head; $cl->{Why}" - ); + "found unprocessable commit, cannot cope: $cl->{Why}", + " ($head)"); return (undef,undef); } $head = $cl->{Parents}[0]{CommitId}; -- cgit v1.2.3