Merge branch 'ne/maint-1.6.0-diff-tree-t-r-show-directory'
authorJunio C Hamano <gitster@pobox.com>
Thu, 2 Jul 2009 02:40:47 +0000 (19:40 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 2 Jul 2009 02:40:47 +0000 (19:40 -0700)
* ne/maint-1.6.0-diff-tree-t-r-show-directory:
diff-tree -r -t: include added/removed directories in the output

1  2 
tree-diff.c
diff --combined tree-diff.c
index edd83949bf0896bedff4cab8e2b037eba574a45e,c83a8da39231ef9e12ea695aceef3b2ef60e2600..0459e54d3d89a413330f52ab34662f51924b04ea
@@@ -118,16 -118,10 +118,16 @@@ static int tree_entry_interesting(struc
                                continue;
  
                        /*
 -                       * The base is a subdirectory of a path which
 -                       * was specified, so all of them are interesting.
 +                       * If the base is a subdirectory of a path which
 +                       * was specified, all of them are interesting.
                         */
 -                      return 2;
 +                      if (!matchlen ||
 +                          base[matchlen] == '/' ||
 +                          match[matchlen - 1] == '/')
 +                              return 2;
 +
 +                      /* Just a random prefix match */
 +                      continue;
                }
  
                /* Does the base match? */
@@@ -239,6 -233,12 +239,12 @@@ static void show_entry(struct diff_opti
                if (!tree || type != OBJ_TREE)
                        die("corrupt tree sha %s", sha1_to_hex(sha1));
  
+               if (DIFF_OPT_TST(opt, TREE_IN_RECURSIVE)) {
+                       newbase[baselen + pathlen] = 0;
+                       opt->add_remove(opt, *prefix, mode, sha1, newbase);
+                       newbase[baselen + pathlen] = '/';
+               }
                init_tree_desc(&inner, tree, size);
                show_tree(opt, prefix, &inner, newbase, baselen + 1 + pathlen);
  
@@@ -374,7 -374,7 +380,7 @@@ static void try_to_follow_renames(struc
        }
  
        /*
 -       * Then, discard all the non-relevane file pairs...
 +       * Then, discard all the non-relevant file pairs...
         */
        for (i = 0; i < q->nr; i++) {
                struct diff_filepair *p = q->queue[i];