ls-files: convert show_ce_entry 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:14 UTC
ff020a8ab0a40a3f938a30be6d73607c2041cc34
1 file changed
+6
-5
builtin/ls-files.c
+6
-5
@@ -232,7 +232,8 @@ static void show_gitlink(const struct cache_entry *ce)
232
exit(status);
233
}
234
235
-static void show_ce_entry(const char *tag, const struct cache_entry *ce)
235
+static void show_ce_entry(const struct index_state *istate,
236
+ const char *tag, const struct cache_entry *ce)
237
{
238
struct strbuf name = STRBUF_INIT;
239
int len = max_prefix_len;
@@ -276,7 +277,7 @@ static void show_ce_entry(const char *tag, const struct cache_entry *ce)
277
find_unique_abbrev(ce->oid.hash, abbrev),
278
ce_stage(ce));
279
}
279
- write_eolinfo(&the_index, ce, ce->name);
280
+ write_eolinfo(istate, ce, ce->name);
281
write_name(ce->name);
282
if (debug_mode) {
283
const struct stat_data *sd = &ce->ce_stat_data;
@@ -352,7 +353,7 @@ static void show_files(struct dir_struct *dir)
353
continue;
354
if (ce->ce_flags & CE_UPDATE)
355
continue;
355
- show_ce_entry(ce_stage(ce) ? tag_unmerged :
356
+ show_ce_entry(&the_index, ce_stage(ce) ? tag_unmerged :
357
(ce_skip_worktree(ce) ? tag_skip_worktree : tag_cached), ce);
358
}
359
}
@@ -370,9 +371,9 @@ static void show_files(struct dir_struct *dir)
371
continue;
372
err = lstat(ce->name, &st);
373
if (show_deleted && err)
373
- show_ce_entry(tag_removed, ce);
374
+ show_ce_entry(&the_index, tag_removed, ce);
375
if (show_modified && ce_modified(ce, &st, 0))
375
- show_ce_entry(tag_modified, ce);
376
+ show_ce_entry(&the_index, tag_modified, ce);
377
}
378
}
379
}