chiark / gitweb /
git-debrebase: New get_tree machinery: Fix debugging
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 19 Aug 2018 16:46:42 +0000 (17:46 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 19 Aug 2018 16:46:42 +0000 (17:46 +0100)
When we localise, we get a new variable, rather than localising the
binding imported from Debian::Dgit.  How annoying.

Also, add two new debug prints at level 3.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
git-debrebase

index e5639a2763ecbaf5114828a5947fd3b0dd9bcdd7..8fa5adb73b34f29054f4bd043551e3143f1a724a 100755 (executable)
@@ -193,7 +193,7 @@ sub get_tree ($) {
     my $memo = $get_tree_memo{$x};
     return @$memo if $memo;
 
-    local $debugcmd_when_debuglevel = 3;
+    local $Debian::Dgit::debugcmd_when_debuglevel = 3;
     my @l;
     my @cmd = (qw(git ls-tree -z --full-tree --), $x);
     my $o = cmdoutput @cmd;
@@ -223,11 +223,15 @@ sub trees_diff_walk ($$$;$) {
     return if !$all and $x eq $y;
     my @x = get_tree $x;
     my @y = get_tree $y;
+    printdebug "trees_diff_walk(..$x,$y..) ".Dumper(\@x,\@y)
+       if $debuglevel >= 3;
     while (@x || @y) {
        my $cmp = !@x       <=> !@y          # eg @y empty? $cmp=-1, use x
             ||    $x[0][0] cmp  $y[0][0];   # eg, x lt y ? $cmp=-1, use x
        my ($n, $ix, $iy);                   # all same? $cmp=0, use both
        $ix=$iy='';
+       printdebug "trees_diff_walk $cmp : @{ $x[0]//[] } | @{ $y[0]//[] }\n"
+           if $debuglevel >= 3;
        ($n, $ix) = @{ shift @x } if $cmp <= 0;
        ($n, $iy) = @{ shift @y } if $cmp >= 0;
        next if !$all and $ix eq $iy;