From fbc1ed629e3c71b47a04ab86b88497984bc6acbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Sat, 19 Nov 2022 14:07:30 +0100 Subject: cocci & cache.h: remove rarely used "the_index" compat macros MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since 4aab5b46f44 (Make read-cache.c "the_index" free., 2007-04-01) we've been undergoing a slow migration away from these macros, but haven't made much progress since f8adbec9fea (cache.h: flip NO_THE_INDEX_COMPATIBILITY_MACROS switch, 2019-01-24). Let's move forward a bit by changing the users of those macros that are rare enough that we can convert them in one go, and then remove the compatibility shim. The only manual change to the C code here is to "cache.h", the rest is all the result of applying the new "index-compatibility.cocci". Even though it's a one-off, let's keep the coccinelle rules for now. We'll extend them in subsequent commits, and this will help anything that's in-flight or out-of-tree to migrate. Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- builtin/checkout.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'builtin/checkout.c') diff --git a/builtin/checkout.c b/builtin/checkout.c index 2a132392fb..aa610b274e 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -722,7 +722,7 @@ static void init_topts(struct unpack_trees_options *topts, int merge, setup_unpack_trees_porcelain(topts, "checkout"); - topts->initial_checkout = is_cache_unborn(); + topts->initial_checkout = is_index_unborn(&the_index); topts->update = 1; topts->merge = 1; topts->quiet = merge && old_commit; @@ -763,7 +763,7 @@ static int merge_working_tree(const struct checkout_opts *opts, refresh_cache(REFRESH_QUIET); - if (unmerged_cache()) { + if (unmerged_index(&the_index)) { error(_("you need to resolve your current index first")); return 1; } -- cgit v1.2.1