coccinelle patch: @@ expression E; @@ -read_cache_preload(E) +read_index_preload(&the_index, E) Additionally manual editing: * drop the define from cache.h. * builtin/{commit,describe}.c were not picked up as we have NULL and the address of an expression. Converted them manually. * builtin/diff{-files,-index}.c error messages converted as well. Signed-off-by: Stefan Beller <sbeller@xxxxxxxxxx> --- builtin/checkout.c | 4 ++-- builtin/commit.c | 4 ++-- builtin/describe.c | 2 +- builtin/diff-files.c | 4 ++-- builtin/diff-index.c | 4 ++-- builtin/diff.c | 8 ++++---- builtin/update-index.c | 2 +- cache.h | 1 - 8 files changed, 14 insertions(+), 15 deletions(-) diff --git a/builtin/checkout.c b/builtin/checkout.c index 0aac616ad6..2328a475ea 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -295,7 +295,7 @@ static int checkout_paths(const struct checkout_opts *opts, lock_file = xcalloc(1, sizeof(struct lock_file)); hold_locked_index(lock_file, LOCK_DIE_ON_ERROR); - if (read_cache_preload(&opts->pathspec) < 0) + if (read_index_preload(&the_index, &opts->pathspec) < 0) return error(_("index file corrupt")); if (opts->source_tree) @@ -488,7 +488,7 @@ static int merge_working_tree(const struct checkout_opts *opts, struct lock_file *lock_file = xcalloc(1, sizeof(struct lock_file)); hold_locked_index(lock_file, LOCK_DIE_ON_ERROR); - if (read_cache_preload(NULL) < 0) + if (read_index_preload(&the_index, NULL) < 0) return error(_("index file corrupt")); resolve_undo_clear(); diff --git a/builtin/commit.c b/builtin/commit.c index 65a04ac199..687e7c8a3a 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -346,7 +346,7 @@ static const char *prepare_index(int argc, const char **argv, const char *prefix PATHSPEC_PREFER_FULL, prefix, argv); - if (read_cache_preload(&pathspec) < 0) + if (read_index_preload(&the_index, &pathspec) < 0) die(_("index file corrupt")); if (interactive) { @@ -1377,7 +1377,7 @@ int cmd_status(int argc, const char **argv, const char *prefix) PATHSPEC_PREFER_FULL, prefix, argv); - read_cache_preload(&s.pathspec); + read_index_preload(&the_index, &s.pathspec); refresh_index(&the_index, REFRESH_QUIET|REFRESH_UNMERGED, &s.pathspec, NULL, NULL); fd = hold_locked_index(&index_lock, 0); diff --git a/builtin/describe.c b/builtin/describe.c index a5cd8c513f..0229458ac6 100644 --- a/builtin/describe.c +++ b/builtin/describe.c @@ -531,7 +531,7 @@ int cmd_describe(int argc, const char **argv, const char *prefix) static struct lock_file index_lock; int fd; - read_cache_preload(NULL); + read_index_preload(&the_index, NULL); refresh_index(&the_index, REFRESH_QUIET|REFRESH_UNMERGED, NULL, NULL, NULL); fd = hold_locked_index(&index_lock, 0); diff --git a/builtin/diff-files.c b/builtin/diff-files.c index 15c61fd8d1..d400d8c1fc 100644 --- a/builtin/diff-files.c +++ b/builtin/diff-files.c @@ -62,8 +62,8 @@ int cmd_diff_files(int argc, const char **argv, const char *prefix) (rev.diffopt.output_format & DIFF_FORMAT_PATCH)) rev.combine_merges = rev.dense_combined_merges = 1; - if (read_cache_preload(&rev.diffopt.pathspec) < 0) { - perror("read_cache_preload"); + if (read_index_preload(&the_index, &rev.diffopt.pathspec) < 0) { + perror("read_index_preload"); return -1; } result = run_diff_files(&rev, options); diff --git a/builtin/diff-index.c b/builtin/diff-index.c index 49fd64d4ce..3fbe33a90a 100644 --- a/builtin/diff-index.c +++ b/builtin/diff-index.c @@ -44,8 +44,8 @@ int cmd_diff_index(int argc, const char **argv, const char *prefix) usage(diff_cache_usage); if (!cached) { setup_work_tree(); - if (read_cache_preload(&rev.diffopt.pathspec) < 0) { - perror("read_cache_preload"); + if (read_index_preload(&the_index, &rev.diffopt.pathspec) < 0) { + perror("read_index_preload"); return -1; } } else if (read_index(&the_index) < 0) { diff --git a/builtin/diff.c b/builtin/diff.c index ed9edb2d0c..0ae33bce2b 100644 --- a/builtin/diff.c +++ b/builtin/diff.c @@ -144,8 +144,8 @@ static int builtin_diff_index(struct rev_info *revs, usage(builtin_diff_usage); if (!cached) { setup_work_tree(); - if (read_cache_preload(&revs->diffopt.pathspec) < 0) { - perror("read_cache_preload"); + if (read_index_preload(&the_index, &revs->diffopt.pathspec) < 0) { + perror("read_index_preload"); return -1; } } else if (read_index(&the_index) < 0) { @@ -246,8 +246,8 @@ static int builtin_diff_files(struct rev_info *revs, int argc, const char **argv revs->combine_merges = revs->dense_combined_merges = 1; setup_work_tree(); - if (read_cache_preload(&revs->diffopt.pathspec) < 0) { - perror("read_cache_preload"); + if (read_index_preload(&the_index, &revs->diffopt.pathspec) < 0) { + perror("read_index_preload"); return -1; } return run_diff_files(revs, options); diff --git a/builtin/update-index.c b/builtin/update-index.c index 9b93e09765..8667c48446 100644 --- a/builtin/update-index.c +++ b/builtin/update-index.c @@ -766,7 +766,7 @@ struct refresh_params { static int refresh(struct refresh_params *o, unsigned int flag) { setup_work_tree(); - read_cache_preload(NULL); + read_index_preload(&the_index, NULL); *o->has_errors |= refresh_cache(o->flags | flag); return 0; } diff --git a/cache.h b/cache.h index 6abf48dcc3..a66ae97fb7 100644 --- a/cache.h +++ b/cache.h @@ -354,7 +354,6 @@ extern void free_name_hash(struct index_state *istate); #ifndef NO_THE_INDEX_COMPATIBILITY_MACROS -#define read_cache_preload(pathspec) read_index_preload(&the_index, (pathspec)) #define is_cache_unborn() is_index_unborn(&the_index) #define read_cache_unmerged() read_index_unmerged(&the_index) #define discard_cache() discard_index(&the_index) -- 2.13.0.rc1.1.gbc33f0f778