builtin/fmt-merge-message: convert to struct object_id
[gitweb.git] / builtin / ls-tree.c
index 0e30d862303b67ace2c7accf2e7c9346d8f63264..d7ebeb4ce6b1f1a0491f8db8a66001968a41b641 100644 (file)
@@ -31,21 +31,18 @@ static const  char * const ls_tree_usage[] = {
 
 static int show_recursive(const char *base, int baselen, const char *pathname)
 {
-       const char **s;
+       int i;
 
        if (ls_options & LS_RECURSIVE)
                return 1;
 
-       s = pathspec._raw;
-       if (!s)
+       if (!pathspec.nr)
                return 0;
 
-       for (;;) {
-               const char *spec = *s++;
+       for (i = 0; i < pathspec.nr; i++) {
+               const char *spec = pathspec.items[i].match;
                int len, speclen;
 
-               if (!spec)
-                       return 0;
                if (strncmp(base, spec, baselen))
                        continue;
                len = strlen(pathname);
@@ -59,6 +56,7 @@ static int show_recursive(const char *base, int baselen, const char *pathname)
                        continue;
                return 1;
        }
+       return 0;
 }
 
 static int show_tree(const unsigned char *sha1, struct strbuf *base,
@@ -175,8 +173,8 @@ int cmd_ls_tree(int argc, const char **argv, const char *prefix)
         * cannot be lifted until it is converted to use
         * match_pathspec() or tree_entry_interesting()
         */
-       parse_pathspec(&pathspec, PATHSPEC_GLOB | PATHSPEC_ICASE |
-                                 PATHSPEC_EXCLUDE,
+       parse_pathspec(&pathspec, PATHSPEC_ALL_MAGIC &
+                                 ~(PATHSPEC_FROMTOP | PATHSPEC_LITERAL),
                       PATHSPEC_PREFER_CWD,
                       prefix, argv + 1);
        for (i = 0; i < pathspec.nr; i++)