reset: optionally setup worktree and refresh index on --mixed
[gitweb.git] / builtin / ls-tree.c
index fb76e38d849fc6f7b9cc1a534f62efb605a3655c..65ec93184614619cac925c17ef3ebc90cd30a82c 100644 (file)
@@ -10,6 +10,7 @@
 #include "quote.h"
 #include "builtin.h"
 #include "parse-options.h"
+#include "pathspec.h"
 
 static int line_termination = '\n';
 #define LS_RECURSIVE 1
@@ -35,7 +36,7 @@ static int show_recursive(const char *base, int baselen, const char *pathname)
        if (ls_options & LS_RECURSIVE)
                return 1;
 
-       s = pathspec.raw;
+       s = pathspec._raw;
        if (!s)
                return 0;
 
@@ -138,9 +139,9 @@ int cmd_ls_tree(int argc, const char **argv, const char *prefix)
                        LS_NAME_ONLY),
                OPT_SET_INT(0, "full-name", &chomp_prefix,
                            N_("use full path names"), 0),
-               OPT_BOOLEAN(0, "full-tree", &full_tree,
-                           N_("list entire tree; not just current directory "
-                              "(implies --full-name)")),
+               OPT_BOOL(0, "full-tree", &full_tree,
+                        N_("list entire tree; not just current directory "
+                           "(implies --full-name)")),
                OPT__ABBREV(&abbrev),
                OPT_END()
        };
@@ -166,7 +167,15 @@ int cmd_ls_tree(int argc, const char **argv, const char *prefix)
        if (get_sha1(argv[0], sha1))
                die("Not a valid object name %s", argv[0]);
 
-       init_pathspec(&pathspec, get_pathspec(prefix, argv + 1));
+       /*
+        * show_recursive() rolls its own matching code and is
+        * generally ignorant of 'struct pathspec'. The magic mask
+        * cannot be lifted until it is converted to use
+        * match_pathspec_depth() or tree_entry_interesting()
+        */
+       parse_pathspec(&pathspec, PATHSPEC_GLOB | PATHSPEC_ICASE,
+                      PATHSPEC_PREFER_CWD,
+                      prefix, argv + 1);
        for (i = 0; i < pathspec.nr; i++)
                pathspec.items[i].nowildcard_len = pathspec.items[i].len;
        pathspec.has_wildcard = 0;