From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Taylor Blau <me@ttaylorr.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH 12/12] builtin/*: remove or amend "USE_THE_INDEX_COMPATIBILITY_MACROS"
Date: Fri, 18 Nov 2022 20:27:25 +0100 [thread overview]
Message-ID: <221118.86mt8of3hi.gmgdl@evledraar.gmail.com> (raw)
In-Reply-To: <Y3fSJwm7qoVmvPA8@nand.local>
On Fri, Nov 18 2022, Taylor Blau wrote:
> On Fri, Nov 18, 2022 at 12:31:06PM +0100, Ævar Arnfjörð Bjarmason wrote:
>> Follow-up the preceding commit and change
>> "USE_THE_INDEX_COMPATIBILITY_MACROS" to the more narrow
>> "USE_THE_INDEX_VARIABLE" in cases where we still use "the_index".
>>
>> Then remove "USE_THE_INDEX_VARIABLE" entirely in the few cases where
>> we don't require any compatibility macros or variables anymore.
>
> Could this get squashed into the previous commit? IOW, is there any
> reason to keep them separate?
I figured it would be easier to review if I split out the changes that
are coccinelle-created v.s. the ones I made manually.
But I don't have a preference at all, whatever you think is easier.
This *could* also be a 3 patch series, which I'd prefer, but figured it
would get push-back, so I thought I'd spoon-feed the list.
I.e. just:
1. Fix discard_index() return value
2. Add and apply the *.cocci rule to *ALL THE THINGS*"
3. Narrow down the macro for t/helper/*
At that point we wouldn't need "USE_THE_INDEX_VARIABLE", as we'd have
nothing except "the_index", so "USE_THE_INDEX_COMPATIBILITY_MACROS"
would do exactly what "USE_THE_INDEX_VARIABLE" does in this topic.
(We could still rename it, but I think probably the churn isn't worth it
if it's not a stop-gap to new macro use being re-introduced)
It would rip the band-aid off, there's conflicts, but the --remerge-diff
with "seen" is rather easy, or:
diff --git a/builtin/commit.c b/builtin/commit.c
remerge CONFLICT (content): Merge conflict in builtin/commit.c
index 4fb7604cc24..c7dbdb2a866 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -991,16 +991,11 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
struct object_id oid;
const char *parent = "HEAD";
-<<<<<<< c23106a1d9f (hi)
- if (!the_index.cache_nr && repo_read_index(the_repository) < 0)
- die(_("Cannot read index"));
-=======
- if (!active_nr) {
- discard_cache();
- if (read_cache() < 0)
+ if (!the_index.cache_nr) {
+ discard_index(&the_index);
+ if (repo_read_index(the_repository) < 0)
die(_("Cannot read index"));
}
->>>>>>> 75ae5b855fb (Merge branch 'rj/branch-copy-and-rename' into seen)
if (amend)
parent = "HEAD^1";
diff --git a/builtin/read-tree.c b/builtin/read-tree.c
remerge CONFLICT (content): Merge conflict in builtin/read-tree.c
index 5dcf0d09ed1..5d6e638c4b1 100644
--- a/builtin/read-tree.c
+++ b/builtin/read-tree.c
@@ -250,15 +250,11 @@ int cmd_read_tree(int argc, const char **argv, const char *cmd_prefix)
if (opts.debug_unpack)
opts.fn = debug_merge;
-<<<<<<< c23106a1d9f (hi)
- cache_tree_free(&the_index.cache_tree);
-=======
/* If we're going to prime_cache_tree later, skip cache tree update */
if (nr_trees == 1 && !opts.prefix)
opts.skip_cache_tree_update = 1;
- cache_tree_free(&active_cache_tree);
->>>>>>> 75ae5b855fb (Merge branch 'rj/branch-copy-and-rename' into seen)
+ cache_tree_free(&the_index.cache_tree);
for (i = 0; i < nr_trees; i++) {
struct tree *tree = trees[i];
parse_tree(tree);
diff --git a/t/helper/test-cache-tree.c b/t/helper/test-cache-tree.c
index 93051b25f56..5514afdfe7a 100644
--- a/t/helper/test-cache-tree.c
+++ b/t/helper/test-cache-tree.c
@@ -30,7 +30,7 @@ int cmd__cache_tree(int argc, const char **argv)
argc = parse_options(argc, argv, NULL, options, test_cache_tree_usage, 0);
- if (read_cache() < 0)
+ if (repo_read_index(the_repository) < 0)
die(_("unable to read index file"));
oidcpy(&oid, &the_index.cache_tree->oid);
...and can also be applied by a "take theirs", re-run the cocci, apply
cocci patch, so no manual resolution needed. Any future conflicts would
be solved with the same procedure.
The diff would be just under ~2k lines, but pretty trivial in terms of
non-cocci changes.
Anyway, just let me know. Right now I'm assuming I'll just re-roll this
(pending any further feedback for a bit) with squashing & some other
minor changes...
next prev parent reply other threads:[~2022-11-18 19:48 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-18 11:30 [PATCH 00/12] tree-wide: chip away at USE_THE_INDEX_COMPATIBILITY_MACROS Ævar Arnfjörð Bjarmason
2022-11-18 11:30 ` [PATCH 01/12] cache.h: remove unused "the_index" compat macros Ævar Arnfjörð Bjarmason
2022-11-18 11:30 ` [PATCH 02/12] builtin/{grep,log}.: don't define "USE_THE_INDEX_COMPATIBILITY_MACROS" Ævar Arnfjörð Bjarmason
2022-11-18 11:30 ` [PATCH 03/12] cocci & cache.h: remove rarely used "the_index" compat macros Ævar Arnfjörð Bjarmason
2022-11-18 11:30 ` [PATCH 04/12] read-cache API & users: make discard_index() return void Ævar Arnfjörð Bjarmason
2022-11-18 11:30 ` [PATCH 05/12] cocci: add a index-compatibility.pending.cocci Ævar Arnfjörð Bjarmason
2022-11-18 11:31 ` [PATCH 06/12] cocci & cache.h: apply a selection of "pending" index-compatibility Ævar Arnfjörð Bjarmason
2022-11-18 11:31 ` [PATCH 07/12] cocci & cache.h: apply variable section " Ævar Arnfjörð Bjarmason
2022-11-18 11:31 ` [PATCH 08/12] cocci: apply "pending" index-compatibility to "t/helper/*.c" Ævar Arnfjörð Bjarmason
2022-11-18 11:31 ` [PATCH 09/12] {builtin/*,repository}.c: add & use "USE_THE_INDEX_VARIABLE" Ævar Arnfjörð Bjarmason
2022-11-18 18:41 ` Taylor Blau
2022-11-18 11:31 ` [PATCH 10/12] cache.h & test-tool.h: " Ævar Arnfjörð Bjarmason
2022-11-18 18:41 ` Taylor Blau
2022-11-18 11:31 ` [PATCH 11/12] cocci: apply "pending" index-compatibility to some "builtin/*.c" Ævar Arnfjörð Bjarmason
2022-11-18 11:31 ` [PATCH 12/12] builtin/*: remove or amend "USE_THE_INDEX_COMPATIBILITY_MACROS" Ævar Arnfjörð Bjarmason
2022-11-18 18:42 ` Taylor Blau
2022-11-18 19:27 ` Ævar Arnfjörð Bjarmason [this message]
2022-11-18 23:04 ` Taylor Blau
2022-11-18 12:13 ` [PATCH 00/12] tree-wide: chip away at USE_THE_INDEX_COMPATIBILITY_MACROS Phillip Wood
2022-11-18 12:21 ` Ævar Arnfjörð Bjarmason
2022-11-19 13:07 ` [PATCH v2 00/11] " Ævar Arnfjörð Bjarmason
2022-11-19 13:07 ` [PATCH v2 01/11] cache.h: remove unused "the_index" compat macros Ævar Arnfjörð Bjarmason
2022-11-19 13:07 ` [PATCH v2 02/11] builtin/{grep,log}.: don't define "USE_THE_INDEX_COMPATIBILITY_MACROS" Ævar Arnfjörð Bjarmason
2022-11-19 13:07 ` [PATCH v2 03/11] cocci & cache.h: remove rarely used "the_index" compat macros Ævar Arnfjörð Bjarmason
2022-11-19 13:07 ` [PATCH v2 04/11] read-cache API & users: make discard_index() return void Ævar Arnfjörð Bjarmason
2022-11-19 13:07 ` [PATCH v2 05/11] cocci: add a index-compatibility.pending.cocci Ævar Arnfjörð Bjarmason
2022-11-19 13:07 ` [PATCH v2 06/11] cocci & cache.h: apply a selection of "pending" index-compatibility Ævar Arnfjörð Bjarmason
2022-11-19 13:07 ` [PATCH v2 07/11] cocci & cache.h: apply variable section " Ævar Arnfjörð Bjarmason
2022-11-19 13:07 ` [PATCH v2 08/11] cocci: apply "pending" index-compatibility to "t/helper/*.c" Ævar Arnfjörð Bjarmason
2022-11-19 13:07 ` [PATCH v2 09/11] {builtin/*,repository}.c: add & use "USE_THE_INDEX_VARIABLE" Ævar Arnfjörð Bjarmason
2022-11-19 13:07 ` [PATCH v2 10/11] cache.h & test-tool.h: " Ævar Arnfjörð Bjarmason
2022-11-19 13:07 ` [PATCH v2 11/11] cocci: apply "pending" index-compatibility to some "builtin/*.c" Ævar Arnfjörð Bjarmason
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=221118.86mt8of3hi.gmgdl@evledraar.gmail.com \
--to=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=me@ttaylorr.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.
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 NNTP newsgroup(s).