diff-lib: drop unused index argument from get_stat_data()

The "struct index_state" parameter passed to get_stat_data() has been unused since we stopped passing it to check_removed() in 6a044a2048 (diff-lib: fix check_removed when fsmonitor is on, 2023-09-11). We can just drop it, which in turns lets us simplify our callers a bit. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Aug 17, 2024 at 03:29 UTC 72c9793c154edbde16085f0f04db970e082c7f0b
1 file changed +3 -6
diff-lib.c
+3 -6
@@ -308,8 +308,7 @@ static void diff_index_show_file(struct rev_info *revs,
308 oid, oid_valid, ce->name, dirty_submodule);
309 }
310
311 -static int get_stat_data(const struct index_state *istate,
312 - const struct cache_entry *ce,
311 +static int get_stat_data(const struct cache_entry *ce,
312 const struct object_id **oidp,
313 unsigned int *modep,
314 int cached, int match_missing,
@@ -352,7 +351,6 @@ static void show_new_file(struct rev_info *revs,
351 const struct object_id *oid;
352 unsigned int mode;
353 unsigned dirty_submodule = 0;
355 - struct index_state *istate = revs->diffopt.repo->index;
354
355 if (new_file && S_ISSPARSEDIR(new_file->ce_mode)) {
356 diff_tree_oid(NULL, &new_file->oid, new_file->name, &revs->diffopt);
@@ -363,7 +361,7 @@ static void show_new_file(struct rev_info *revs,
361 * New file in the index: it might actually be different in
362 * the working tree.
363 */
366 - if (get_stat_data(istate, new_file, &oid, &mode, cached, match_missing,
364 + if (get_stat_data(new_file, &oid, &mode, cached, match_missing,
365 &dirty_submodule, &revs->diffopt) < 0)
366 return;
367
@@ -379,7 +377,6 @@ static int show_modified(struct rev_info *revs,
377 unsigned int mode, oldmode;
378 const struct object_id *oid;
379 unsigned dirty_submodule = 0;
382 - struct index_state *istate = revs->diffopt.repo->index;
380
381 assert(S_ISSPARSEDIR(old_entry->ce_mode) ==
382 S_ISSPARSEDIR(new_entry->ce_mode));
@@ -395,7 +392,7 @@ static int show_modified(struct rev_info *revs,
392 return 0;
393 }
394
398 - if (get_stat_data(istate, new_entry, &oid, &mode, cached, match_missing,
395 + if (get_stat_data(new_entry, &oid, &mode, cached, match_missing,
396 &dirty_submodule, &revs->diffopt) < 0) {
397 if (report_missing)
398 diff_index_show_file(revs, "-", old_entry,