chiark / gitweb /
git-debrebase: classify: Do not misclassify patches in subdirs
[dgit.git] / git-debrebase
index 4a705854c1581754e6eea4c69b1c672ea83b8ea7..ddb47bf6f29645665240cb459891239dcc7b5340 100755 (executable)
@@ -232,12 +232,13 @@ sub trees_diff_walk ($$$;$) {
     # $x and $y are as for get_tree
     # where $name, $ix, $iy are $name and $info from get_tree
     # opts are   all       call even for names same in both
+    #            recurse   call even for names same in both
     my $opts = shift @_ if @_>=4;
     my ($x,$y,$call) = @_;
     my $all = $opts->{all};
     return if !$all and $x eq $y;
-    my @x = get_tree $x;
-    my @y = get_tree $y;
+    my @x = get_tree $x, 0, $opts->{recurse};
+    my @y = get_tree $y, 0, $opts->{recurse};
     printdebug "trees_diff_walk(..$x,$y..) ".Dumper(\@x,\@y)
        if $debuglevel >= 3;
     while (@x || @y) {
@@ -309,13 +310,16 @@ sub get_differs ($$) {
 
            my $xp = $ix && "$xd/patches";
            my $yp = $iy && "$yd/patches";
-           trees_diff_walk $xp, $yp, sub {
+           trees_diff_walk { recurse=>1 }, $xp, $yp, sub {
                my ($n,$ix,$iy) = @_;
 
                # analyse difference in debian/patches
 
                my $ok;
-               if ($n !~ m/\.series$/s && !$ix && $plain->($iy)) {
+               if ($n =~ m{/$}s) {
+                   # we are recursing; directories may appear and disappear
+                   $ok = 1;
+               } elsif ($n !~ m/\.series$/s && !$ix && $plain->($iy)) {
                    $ok = 1;
                } elsif ($n eq 'series' && $plain->($ix) && $plain->($iy)) {
                    my $x_s = (git_cat_file "$xp/series", 'blob');