[PATCH 1/5] read-cache: update add_files_to_cache to take param ignored_too(--force)
- From
- Claus Schneider(Eficode) via GitGitGadget <gitgitgadget@gmail.com>
- Date
- Oct 18, 2025, 20:07 UTC
- Message-ID
- <d98cca698ddb376831c0657eab2c488f9e7585bc.1760818039.git.gitgitgadget@gmail.com>
- In-Reply-To
- <pull.1987.git.1760818039.gitgitgadget@gmail.com>
From: "Claus Schneider(Eficode)" <claus.schneider@eficode.com>
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> --- builtin/add.c | 2 +- builtin/checkout.c | 2 +- builtin/commit.c | 2 +- read-cache-ll.h | 2 +- read-cache.c | 8 +++++++- 5 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/builtin/add.c b/builtin/add.c index 0235854f80..cd1116e70a 100644 --- a/builtin/add.c +++ b/builtin/add.c @@ -582,7 +582,7 @@ int cmd_add(int argc, else exit_status |= add_files_to_cache(repo, prefix, &pathspec, ps_matched, - include_sparse, flags); + include_sparse, flags, ignored_too); if (take_worktree_changes && !add_renormalize && !ignore_add_errors && report_path_error(ps_matched, &pathspec)) diff --git a/builtin/checkout.c b/builtin/checkout.c index f9453473fe..b2a404051d 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -899,7 +899,7 @@ static int merge_working_tree(const struct checkout_opts *opts, */ add_files_to_cache(the_repository, NULL, NULL, NULL, 0, - 0); + 0, 0 ); init_ui_merge_options(&o, the_repository); o.verbosity = 0; work = write_in_core_index_as_tree(the_repository); diff --git a/builtin/commit.c b/builtin/commit.c index b5b9608813..5bf7ae5fc1 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -455,7 +455,7 @@ static const char *prepare_index(const char **argv, const char *prefix, repo_hold_locked_index(the_repository, &index_lock, LOCK_DIE_ON_ERROR); add_files_to_cache(the_repository, also ? prefix : NULL, - &pathspec, ps_matched, 0, 0); + &pathspec, ps_matched, 0, 0, 0 ); if (!all && report_path_error(ps_matched, &pathspec)) exit(128); diff --git a/read-cache-ll.h b/read-cache-ll.h index 71b49d9af4..2c8b4b21b1 100644 --- a/read-cache-ll.h +++ b/read-cache-ll.h @@ -481,7 +481,7 @@ int cmp_cache_name_compare(const void *a_, const void *b_); int add_files_to_cache(struct repository *repo, const char *prefix, const struct pathspec *pathspec, char *ps_matched, - int include_sparse, int flags); + int include_sparse, int flags, int ignored_too ); void overlay_tree_on_index(struct index_state *istate, const char *tree_name, const char *prefix); diff --git a/read-cache.c b/read-cache.c index 06ad74db22..56a3ef424c 100644 --- a/read-cache.c +++ b/read-cache.c @@ -3880,9 +3880,12 @@ void overlay_tree_on_index(struct index_state *istate, struct update_callback_data { struct index_state *index; + struct repository *repo; + struct pathspec *pathspec; int include_sparse; int flags; int add_errors; + int ignored_too; }; static int fix_unmerged_status(struct diff_filepair *p, @@ -3945,7 +3948,7 @@ static void update_callback(struct diff_queue_struct *q, int add_files_to_cache(struct repository *repo, const char *prefix, const struct pathspec *pathspec, char *ps_matched, - int include_sparse, int flags) + int include_sparse, int flags, int ignored_too ) { struct update_callback_data data; struct rev_info rev; @@ -3954,6 +3957,9 @@ int add_files_to_cache(struct repository *repo, const char *prefix, data.index = repo->index; data.include_sparse = include_sparse; data.flags = flags; + data.repo = repo; + data.ignored_too = ignored_too; + data.pathspec = (struct pathspec *)pathspec; repo_init_revisions(repo, &rev, prefix); setup_revisions(0, NULL, &rev, NULL);
-- gitgitgadget