From: Stefan Beller <sbeller@google.com>
To: git@vger.kernel.org
Cc: gitster@pobox.com, Stefan Beller <sbeller@google.com>
Subject: [PATCH 4/5] cache.h: drop read_cache_preload(pathspec)
Date: Mon, 1 May 2017 12:07:18 -0700 [thread overview]
Message-ID: <20170501190719.10669-5-sbeller@google.com> (raw)
In-Reply-To: <20170501190719.10669-1-sbeller@google.com>
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@google.com>
---
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
next prev parent reply other threads:[~2017-05-01 19:08 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-01 19:07 [PATCH 0/5] Start of a journey: drop NO_THE_INDEX_COMPATIBILITY_MACROS Stefan Beller
2017-05-01 19:07 ` [PATCH 1/5] cache.h: drop read_cache() Stefan Beller
2017-05-01 19:07 ` [PATCH 2/5] cache.h: drop active_* macros Stefan Beller
2017-05-01 19:07 ` [PATCH 3/5] cache.h: drop read_cache_from Stefan Beller
2017-05-01 19:07 ` Stefan Beller [this message]
2017-05-01 19:07 ` [PATCH 5/5] cache.h: drop read_cache_unmerged() Stefan Beller
2017-05-02 1:36 ` [PATCH 0/5] Start of a journey: drop NO_THE_INDEX_COMPATIBILITY_MACROS Junio C Hamano
2017-05-02 4:17 ` Stefan Beller
2017-05-02 14:05 ` Jeff Hostetler
2017-05-03 11:31 ` Samuel Lijin
2017-05-03 17:14 ` Stefan Beller
2017-05-03 18:22 ` Samuel Lijin
2017-05-04 3:29 ` Brandon Williams
2017-05-03 10:27 ` Duy Nguyen
2017-05-03 17:02 ` Stefan Beller
2017-05-04 2:48 ` Junio C Hamano
2017-05-04 3:24 ` Brandon Williams
2017-05-04 18:30 ` Stefan Beller
2017-05-05 14:31 ` Johannes Schindelin
2017-05-05 17:20 ` Brandon Williams
2017-05-04 19:19 ` Jonathan Nieder
2017-05-05 17:22 ` Junio C Hamano
2017-05-05 17:29 ` Brandon Williams
2017-05-02 15:35 ` Jeff Hostetler
2017-05-02 17:06 ` Stefan Beller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170501190719.10669-5-sbeller@google.com \
--to=sbeller@google.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).