read-cache: update add_files_to_cache take param ignored_too

The ignored_too parameter is added to the function add_files_to_cache for usage of explicit updating the index for the updated submodule using the explicit patchspec to the submodule. Signed-off-by: Claus Schneider(Eficode) <claus.schneider@eficode.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Claus Schneider(Eficode) committed Feb 6, 2026 at 13:22 UTC 37196d8995ee60e08230c5d05dfd26204d604580
5 files changed +12 -6
builtin/add.c
+1 -1
@@ -584,7 +584,7 @@ int cmd_add(int argc,
584 else
585 exit_status |= add_files_to_cache(repo, prefix,
586 &pathspec, ps_matched,
587 - include_sparse, flags);
587 + include_sparse, flags, ignored_too);
588
589 if (take_worktree_changes && !add_renormalize && !ignore_add_errors &&
590 report_path_error(ps_matched, &pathspec))
builtin/checkout.c
+1 -1
@@ -899,7 +899,7 @@ static int merge_working_tree(const struct checkout_opts *opts,
899 */
900
901 add_files_to_cache(the_repository, NULL, NULL, NULL, 0,
902 - 0);
902 + 0, 0);
903 init_ui_merge_options(&o, the_repository);
904 o.verbosity = 0;
905 work = write_in_core_index_as_tree(the_repository);
builtin/commit.c
+1 -1
@@ -455,7 +455,7 @@ static const char *prepare_index(const char **argv, const char *prefix,
455 repo_hold_locked_index(the_repository, &index_lock,
456 LOCK_DIE_ON_ERROR);
457 add_files_to_cache(the_repository, also ? prefix : NULL,
458 - &pathspec, ps_matched, 0, 0);
458 + &pathspec, ps_matched, 0, 0, 0 );
459 if (!all && report_path_error(ps_matched, &pathspec))
460 exit(128);
461
read-cache-ll.h
+1 -1
@@ -481,7 +481,7 @@ int cmp_cache_name_compare(const void *a_, const void *b_);
481
482 int add_files_to_cache(struct repository *repo, const char *prefix,
483 const struct pathspec *pathspec, char *ps_matched,
484 - int include_sparse, int flags);
484 + int include_sparse, int flags, int ignored_too );
485
486 void overlay_tree_on_index(struct index_state *istate,
487 const char *tree_name, const char *prefix);
read-cache.c
+8 -2
@@ -3878,9 +3878,12 @@ void overlay_tree_on_index(struct index_state *istate,
3878
3879 struct update_callback_data {
3880 struct index_state *index;
3881 + struct repository *repo;
3882 + struct pathspec *pathspec;
3883 int include_sparse;
3884 int flags;
3885 int add_errors;
3886 + int ignored_too;
3887 };
3888
3889 static int fix_unmerged_status(struct diff_filepair *p,
@@ -3922,7 +3925,7 @@ static void update_callback(struct diff_queue_struct *q,
3925 default:
3926 die(_("unexpected diff status %c"), p->status);
3927 case DIFF_STATUS_MODIFIED:
3925 - case DIFF_STATUS_TYPE_CHANGED:
3928 + case DIFF_STATUS_TYPE_CHANGED: {
3929 if (add_file_to_index(data->index, path, data->flags)) {
3930 if (!(data->flags & ADD_CACHE_IGNORE_ERRORS))
3931 die(_("updating files failed"));
@@ -3943,7 +3946,7 @@ static void update_callback(struct diff_queue_struct *q,
3946
3947 int add_files_to_cache(struct repository *repo, const char *prefix,
3948 const struct pathspec *pathspec, char *ps_matched,
3946 - int include_sparse, int flags)
3949 + int include_sparse, int flags, int ignored_too )
3950 {
3951 struct odb_transaction *transaction;
3952 struct update_callback_data data;
@@ -3953,6 +3956,9 @@ int add_files_to_cache(struct repository *repo, const char *prefix,
3956 data.index = repo->index;
3957 data.include_sparse = include_sparse;
3958 data.flags = flags;
3959 + data.repo = repo;
3960 + data.ignored_too = ignored_too;
3961 + data.pathspec = (struct pathspec *)pathspec;
3962
3963 repo_init_revisions(repo, &rev, prefix);
3964 setup_revisions(0, NULL, &rev, NULL);