ls-files: correct index argument to get_convert_attr_ascii()
write_eolinfo() does take an istate as function argument and it should be used instead of the_index. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy committed
Aug 13, 2018 at 18:14 UTC
a52b321d2e2c314d305be86c0310b3627c1aa95b
1 file changed
+9
-8
builtin/ls-files.c
+9
-8
@@ -63,7 +63,7 @@ static void write_eolinfo(const struct index_state *istate,
63
struct stat st;
64
const char *i_txt = "";
65
const char *w_txt = "";
66
- const char *a_txt = get_convert_attr_ascii(&the_index, path);
66
+ const char *a_txt = get_convert_attr_ascii(istate, path);
67
if (ce && S_ISREG(ce->ce_mode))
68
i_txt = get_cached_convert_stats_ascii(istate,
69
ce->name);
@@ -121,18 +121,19 @@ static void print_debug(const struct cache_entry *ce)
121
}
122
}
123
124
-static void show_dir_entry(const char *tag, struct dir_entry *ent)
124
+static void show_dir_entry(const struct index_state *istate,
125
+ const char *tag, struct dir_entry *ent)
126
{
127
int len = max_prefix_len;
128
129
if (len > ent->len)
130
die("git ls-files: internal error - directory entry not superset of prefix");
131
131
- if (!dir_path_match(&the_index, ent, &pathspec, len, ps_matched))
132
+ if (!dir_path_match(istate, ent, &pathspec, len, ps_matched))
133
return;
134
135
fputs(tag, stdout);
135
- write_eolinfo(NULL, NULL, ent->name);
136
+ write_eolinfo(istate, NULL, ent->name);
137
write_name(ent->name);
138
}
139
@@ -145,7 +146,7 @@ static void show_other_files(const struct index_state *istate,
146
struct dir_entry *ent = dir->entries[i];
147
if (!index_name_is_other(istate, ent->name, ent->len))
148
continue;
148
- show_dir_entry(tag_other, ent);
149
+ show_dir_entry(istate, tag_other, ent);
150
}
151
}
152
@@ -196,7 +197,7 @@ static void show_killed_files(const struct index_state *istate,
197
}
198
}
199
if (killed)
199
- show_dir_entry(tag_killed, dir->entries[i]);
200
+ show_dir_entry(istate, tag_killed, dir->entries[i]);
201
}
202
}
203
@@ -228,7 +229,7 @@ static void show_ce(struct repository *repo, struct dir_struct *dir,
229
if (recurse_submodules && S_ISGITLINK(ce->ce_mode) &&
230
is_submodule_active(repo, ce->name)) {
231
show_submodule(repo, dir, ce->name);
231
- } else if (match_pathspec(&the_index, &pathspec, fullname, strlen(fullname),
232
+ } else if (match_pathspec(repo->index, &pathspec, fullname, strlen(fullname),
233
max_prefix_len, ps_matched,
234
S_ISDIR(ce->ce_mode) ||
235
S_ISGITLINK(ce->ce_mode))) {
@@ -264,7 +265,7 @@ static void show_ru_info(const struct index_state *istate)
265
len = strlen(path);
266
if (len < max_prefix_len)
267
continue; /* outside of the prefix */
267
- if (!match_pathspec(&the_index, &pathspec, path, len,
268
+ if (!match_pathspec(istate, &pathspec, path, len,
269
max_prefix_len, ps_matched, 0))
270
continue; /* uninterested */
271
for (i = 0; i < 3; i++) {