dir.c: remove an implicit dependency on the_index in pathspec code
[gitweb.git] / builtin / ls-files.c
index 967b2b3380d9a1eb0ccea9a742c8abfb4004602b..7233b927947cc2a4ea090c08870f9fcdeca16cb0 100644 (file)
@@ -63,7 +63,7 @@ static void write_eolinfo(const struct index_state *istate,
                struct stat st;
                const char *i_txt = "";
                const char *w_txt = "";
-               const char *a_txt = get_convert_attr_ascii(path);
+               const char *a_txt = get_convert_attr_ascii(&the_index, path);
                if (ce && S_ISREG(ce->ce_mode))
                        i_txt = get_cached_convert_stats_ascii(istate,
                                                               ce->name);
@@ -128,7 +128,7 @@ static void show_dir_entry(const char *tag, struct dir_entry *ent)
        if (len > ent->len)
                die("git ls-files: internal error - directory entry not superset of prefix");
 
-       if (!dir_path_match(ent, &pathspec, len, ps_matched))
+       if (!dir_path_match(&the_index, ent, &pathspec, len, ps_matched))
                return;
 
        fputs(tag, stdout);
@@ -228,7 +228,7 @@ static void show_ce(struct repository *repo, struct dir_struct *dir,
        if (recurse_submodules && S_ISGITLINK(ce->ce_mode) &&
            is_submodule_active(repo, ce->name)) {
                show_submodule(repo, dir, ce->name);
-       } else if (match_pathspec(&pathspec, fullname, strlen(fullname),
+       } else if (match_pathspec(&the_index, &pathspec, fullname, strlen(fullname),
                                  max_prefix_len, ps_matched,
                                  S_ISDIR(ce->ce_mode) ||
                                  S_ISGITLINK(ce->ce_mode))) {
@@ -264,7 +264,7 @@ static void show_ru_info(const struct index_state *istate)
                len = strlen(path);
                if (len < max_prefix_len)
                        continue; /* outside of the prefix */
-               if (!match_pathspec(&pathspec, path, len,
+               if (!match_pathspec(&the_index, &pathspec, path, len,
                                    max_prefix_len, ps_matched, 0))
                        continue; /* uninterested */
                for (i = 0; i < 3; i++) {
@@ -556,9 +556,9 @@ int cmd_ls_files(int argc, const char **argv, const char *cmd_prefix)
                { OPTION_CALLBACK, 0, "exclude-standard", &dir, NULL,
                        N_("add the standard git exclusions"),
                        PARSE_OPT_NOARG, option_parse_exclude_standard },
-               { OPTION_SET_INT, 0, "full-name", &prefix_len, NULL,
-                       N_("make the output relative to the project top directory"),
-                       PARSE_OPT_NOARG | PARSE_OPT_NONEG, NULL },
+               OPT_SET_INT_F(0, "full-name", &prefix_len,
+                             N_("make the output relative to the project top directory"),
+                             0, PARSE_OPT_NONEG),
                OPT_BOOL(0, "recurse-submodules", &recurse_submodules,
                        N_("recurse through submodules")),
                OPT_BOOL(0, "error-unmatch", &error_unmatch,