Grammar fix for "git merge" man page
[gitweb.git] / tree-walk.c
index 7170e375b3473aaced9b639d915c93ff931be859..02e2aed7737207225f1b96eed774a1b75dd6d8d9 100644 (file)
@@ -62,7 +62,7 @@ void *fill_tree_descriptor(struct tree_desc *desc, const unsigned char *sha1)
 
 static int entry_compare(struct name_entry *a, struct name_entry *b)
 {
-       return base_name_compare(
+       return df_name_compare(
                        a->path, tree_entry_len(a->path, a->sha1), a->mode,
                        b->path, tree_entry_len(b->path, b->sha1), b->mode);
 }
@@ -107,6 +107,7 @@ int tree_entry(struct tree_desc *desc, struct name_entry *entry)
 void setup_traverse_info(struct traverse_info *info, const char *base)
 {
        int pathlen = strlen(base);
+       static struct traverse_info dummy;
 
        memset(info, 0, sizeof(*info));
        if (pathlen && base[pathlen-1] == '/')
@@ -114,6 +115,8 @@ void setup_traverse_info(struct traverse_info *info, const char *base)
        info->pathlen = pathlen ? pathlen + 1 : 0;
        info->name.path = base;
        info->name.sha1 = (void *)(base + pathlen + 1);
+       if (pathlen)
+               info->prev = &dummy;
 }
 
 char *make_traverse_path(char *path, const struct traverse_info *info, const struct name_entry *n)
@@ -142,6 +145,7 @@ int traverse_trees(int n, struct tree_desc *t, struct traverse_info *info)
 
        for (;;) {
                unsigned long mask = 0;
+               unsigned long dirmask = 0;
                int i, last;
 
                last = -1;
@@ -166,10 +170,13 @@ int traverse_trees(int n, struct tree_desc *t, struct traverse_info *info)
                                        mask = 0;
                        }
                        mask |= 1ul << i;
+                       if (S_ISDIR(entry[i].mode))
+                               dirmask |= 1ul << i;
                        last = i;
                }
                if (!mask)
                        break;
+               dirmask &= mask;
 
                /*
                 * Clear all the unused name-entries.
@@ -179,7 +186,7 @@ int traverse_trees(int n, struct tree_desc *t, struct traverse_info *info)
                                continue;
                        entry_clear(entry + i);
                }
-               ret = info->fn(n, mask, entry, info);
+               ret = info->fn(n, mask, dirmask, entry, info);
                if (ret < 0)
                        break;
                if (ret)