From 87da76cc34151e4623797b32d16c351029969bb6 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 7 Jul 2018 00:15:46 +0100 Subject: git-debrebase: status: Reorganise commit reporting. Replace the references to @_ with a hash. Using a hash is much less confusing than all this numerical indexing. Also, \@_ is wrong because there is only one @_, so by the time it is dereference, the commit being printed is the anchor. This is why in #903131 we see branch is unlaundered found mixed upstream/packaging commit (7badba627162337c7057002f37e9a1a593d07d08) abcc6260 Update to upstream 2.9.7 which appears to sugggest that the anchor is a mixed commit. Actually the mixed commit is 7badba627162 but the subsequent message is based on @_ which has different information in it by then. And, set $kcmsg from the main message, not including the commit information. We are the more sophisticated caller mentioned in the previous commmit. Closes: #903131. Signed-off-by: Ian Jackson --- debian/changelog | 1 + git-debrebase | 23 ++++++++++++++--------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/debian/changelog b/debian/changelog index 375e783..6dea169 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,7 @@ dgit (5.8~) unstable; urgency=medium Bugfixes: * dgit, git-debrebase: Properly make patches even if an awkward .gitignore ignores the things in debian/patches. Closes:#903130. + * git-debrebase status: Fix commit reporting. Closes:903131. * dgit(1): Unscramble push[-source] descriptions. Closes:#903116. -- diff --git a/git-debrebase b/git-debrebase index 292471d..557e789 100755 --- a/git-debrebase +++ b/git-debrebase @@ -1389,15 +1389,20 @@ sub cmd_status () { # todo: gdr status should print upstream component(s) info # todo: gdr should leave/maintain some refs with this kind of info ? - my $oldest = [ 0 ]; + my $oldest = { Badness => 0 }; my $newest; my $note = sub { - my ($badness, $ourmsg, $snagname, $kcmsg, $cl) = @_; - if ($oldest->[0] < $badness) { + my ($badness, $ourmsg, $snagname, $dummy, $cl, $kcmsg) = @_; + if ($oldest->{Badness} < $badness) { $oldest = $newest = undef; } - $oldest = \@_; # we're walking backwards - $newest //= \@_; + $oldest = { + Badness => $badness, + CommitId => $cl->{CommitId}, + OurMsg => $ourmsg, + KcMsg => $kcmsg, + }; + $newest //= $oldest; }; my ($anchor, $bw) = keycommits +(git_rev_parse 'HEAD'), sub { $note->(1, 'branch contains furniture (not laundered)', @_); }, @@ -1414,16 +1419,16 @@ sub cmd_status () { }; print "current branch contents, in git-debrebase terms:\n"; - if (!$oldest->[0]) { + if (!$oldest->{Badness}) { print " branch is laundered\n"; } else { - print " $oldest->[1]\n"; + print " $oldest->{OurMsg}\n"; my $printed = ''; foreach my $info ($oldest, $newest) { - my $cid = $info->[4]{CommitId}; + my $cid = $info->{CommitId}; next if $cid eq $printed; $printed = $cid; - print " $info->[3]\n"; + print " $info->{KcMsg}\n"; $prcommitinfo->($cid); } } -- cgit v1.2.3