ls-files: convert write_eolinfo to take an index

Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Brandon Williams committed Jun 12, 2017 at 15:13 UTC 1985fd68c65f2989033924416367a683b1d8ca67
1 file changed +6 -7
builtin/ls-files.c
+6 -7
@@ -53,17 +53,16 @@ static const char *tag_modified = "";
53 static const char *tag_skip_worktree = "";
54 static const char *tag_resolve_undo = "";
55
56 -static void write_eolinfo(const struct cache_entry *ce, const char *path)
56 +static void write_eolinfo(const struct index_state *istate,
57 + const struct cache_entry *ce, const char *path)
58 {
58 - if (!show_eol)
59 - return;
60 - else {
59 + if (show_eol) {
60 struct stat st;
61 const char *i_txt = "";
62 const char *w_txt = "";
63 const char *a_txt = get_convert_attr_ascii(path);
64 if (ce && S_ISREG(ce->ce_mode))
66 - i_txt = get_cached_convert_stats_ascii(&the_index,
65 + i_txt = get_cached_convert_stats_ascii(istate,
66 ce->name);
67 if (!lstat(path, &st) && S_ISREG(st.st_mode))
68 w_txt = get_wt_convert_stats_ascii(path);
@@ -105,7 +104,7 @@ static void show_dir_entry(const char *tag, struct dir_entry *ent)
104 return;
105
106 fputs(tag, stdout);
108 - write_eolinfo(NULL, ent->name);
107 + write_eolinfo(NULL, NULL, ent->name);
108 write_name(ent->name);
109 }
110
@@ -275,7 +274,7 @@ static void show_ce_entry(const char *tag, const struct cache_entry *ce)
274 find_unique_abbrev(ce->oid.hash, abbrev),
275 ce_stage(ce));
276 }
278 - write_eolinfo(ce, ce->name);
277 + write_eolinfo(&the_index, ce, ce->name);
278 write_name(ce->name);
279 if (debug_mode) {
280 const struct stat_data *sd = &ce->ce_stat_data;