chiark / gitweb /
git-debrebase: status: Reorganise commit reporting.
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 6 Jul 2018 23:15:46 +0000 (00:15 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 6 Jul 2018 23:21:09 +0000 (00:21 +0100)
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 <ijackson@chiark.greenend.org.uk>
debian/changelog
git-debrebase

index 375e783a75b71228d41de19a5f1de55340ab5ab6..6dea1695c50947a6dde65cc1cad2b9082de51074 100644 (file)
@@ -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.
 
  --
index 292471de90c33fc2e359a717d5a5ab5907eb56dd..557e7898a1cd8fa11771982a2f9717177000a7a7 100755 (executable)
@@ -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);
        }
     }