Skip to content

Commit 37196d8

Browse files
bicschneidergitster
authored andcommitted
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>
1 parent 8745eae commit 37196d8

File tree

5 files changed

+12
-6
lines changed

5 files changed

+12
-6
lines changed

builtin/add.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ int cmd_add(int argc,
584584
else
585585
exit_status |= add_files_to_cache(repo, prefix,
586586
&pathspec, ps_matched,
587-
include_sparse, flags);
587+
include_sparse, flags, ignored_too);
588588

589589
if (take_worktree_changes && !add_renormalize && !ignore_add_errors &&
590590
report_path_error(ps_matched, &pathspec))

builtin/checkout.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,7 @@ static int merge_working_tree(const struct checkout_opts *opts,
899899
*/
900900

901901
add_files_to_cache(the_repository, NULL, NULL, NULL, 0,
902-
0);
902+
0, 0);
903903
init_ui_merge_options(&o, the_repository);
904904
o.verbosity = 0;
905905
work = write_in_core_index_as_tree(the_repository);

builtin/commit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ static const char *prepare_index(const char **argv, const char *prefix,
455455
repo_hold_locked_index(the_repository, &index_lock,
456456
LOCK_DIE_ON_ERROR);
457457
add_files_to_cache(the_repository, also ? prefix : NULL,
458-
&pathspec, ps_matched, 0, 0);
458+
&pathspec, ps_matched, 0, 0, 0 );
459459
if (!all && report_path_error(ps_matched, &pathspec))
460460
exit(128);
461461

read-cache-ll.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ int cmp_cache_name_compare(const void *a_, const void *b_);
481481

482482
int add_files_to_cache(struct repository *repo, const char *prefix,
483483
const struct pathspec *pathspec, char *ps_matched,
484-
int include_sparse, int flags);
484+
int include_sparse, int flags, int ignored_too );
485485

486486
void overlay_tree_on_index(struct index_state *istate,
487487
const char *tree_name, const char *prefix);

read-cache.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3878,9 +3878,12 @@ void overlay_tree_on_index(struct index_state *istate,
38783878

38793879
struct update_callback_data {
38803880
struct index_state *index;
3881+
struct repository *repo;
3882+
struct pathspec *pathspec;
38813883
int include_sparse;
38823884
int flags;
38833885
int add_errors;
3886+
int ignored_too;
38843887
};
38853888

38863889
static int fix_unmerged_status(struct diff_filepair *p,
@@ -3922,7 +3925,7 @@ static void update_callback(struct diff_queue_struct *q,
39223925
default:
39233926
die(_("unexpected diff status %c"), p->status);
39243927
case DIFF_STATUS_MODIFIED:
3925-
case DIFF_STATUS_TYPE_CHANGED:
3928+
case DIFF_STATUS_TYPE_CHANGED: {
39263929
if (add_file_to_index(data->index, path, data->flags)) {
39273930
if (!(data->flags & ADD_CACHE_IGNORE_ERRORS))
39283931
die(_("updating files failed"));
@@ -3943,7 +3946,7 @@ static void update_callback(struct diff_queue_struct *q,
39433946

39443947
int add_files_to_cache(struct repository *repo, const char *prefix,
39453948
const struct pathspec *pathspec, char *ps_matched,
3946-
int include_sparse, int flags)
3949+
int include_sparse, int flags, int ignored_too )
39473950
{
39483951
struct odb_transaction *transaction;
39493952
struct update_callback_data data;
@@ -3953,6 +3956,9 @@ int add_files_to_cache(struct repository *repo, const char *prefix,
39533956
data.index = repo->index;
39543957
data.include_sparse = include_sparse;
39553958
data.flags = flags;
3959+
data.repo = repo;
3960+
data.ignored_too = ignored_too;
3961+
data.pathspec = (struct pathspec *)pathspec;
39563962

39573963
repo_init_revisions(repo, &rev, prefix);
39583964
setup_revisions(0, NULL, &rev, NULL);

0 commit comments

Comments
 (0)