path: root/builtin/ls-files.c
diff options
authorNguyễn Thái Ngọc Duy <>2018-08-13 16:14:22 (GMT)
committerJunio C Hamano <>2018-08-13 21:14:42 (GMT)
commit6d2df284e7f4d7cd9f46992282ef59a72a9db527 (patch)
treee574b2e2c62144926ced7a251f82260a61211d16 /builtin/ls-files.c
parent7f944e264ebe2fcf9a2c228a9fc9463ab3274d39 (diff)
dir.c: remove an implicit dependency on the_index in pathspec code
Make the match_patchspec API and friends take an index_state instead of assuming the_index in dir.c. All external call sites are converted blindly to keep the patch simple and retain current behavior. Individual call sites may receive further updates to use the right index instead of the_index. Signed-off-by: Nguyễn Thái Ngọc Duy <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'builtin/ls-files.c')
1 files changed, 3 insertions, 3 deletions
diff --git a/builtin/ls-files.c b/builtin/ls-files.c
index d996734..7233b92 100644
--- a/builtin/ls-files.c
+++ b/builtin/ls-files.c
@@ -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))
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++) {