[PATCH 00/12] Remove more index compatibility macros
- From
Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com>
- Date
- Jan 1, 2021, 13:06 UTC
- Message-ID
- <pull.830.git.1609506428.gitgitgadget@gmail.com>
I noticed that Duy's project around USE_THE_INDEX_COMPATIBILITY_MACROS has been on pause for a while. Here is my attempt to continue that project a little.
I started going through the builtins that still use cache_name_pos() and the first few were easy: merge-inex, mv, rm.
Then I hit update-index and it was a bit bigger. It's included here as well.
My strategy for update-index was to create static globals "repo" and "istate" that point to the_repository and the_index, respectively. Then, I was able to remove macros one-by-one without changing method prototypes within the file.
I had started trying to keep everything local to the method signatures, but I hit a snag when reaching the command-line parsing callbacks, which I could not modify their call signature. At that point, I had something that was already much more complicated than what I present now. Outside of the first update-index commit, everything was a mechanical find/replace.
In total, this allows us to remove four of the compatibility macros because they are no longer used.
Thanks, -Stolee
Derrick Stolee (12): merge-index: drop index compatibility macros mv: remove index compatibility macros rm: remove compatilibity macros update-index: drop the_index, the_repository update-index: use istate->cache over active_cache update-index: use index->cache_nr over active_nr update-index: use istate->cache_changed update-index: use index_name_pos() over cache_name_pos() update-index: use remove_file_from_index() update-index: use add_index_entry() update-index: replace several compatibility macros update-index: remove ce_match_stat(), all macros
Documentation/technical/racy-git.txt | 6 +- builtin/merge-index.c | 33 +++--- builtin/mv.c | 42 ++++---- builtin/rm.c | 56 ++++++----- builtin/update-index.c | 145 ++++++++++++++------------- cache.h | 4 - 6 files changed, 149 insertions(+), 137 deletions(-)
base-commit: 71ca53e8125e36efbda17293c50027d31681a41f Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-830%2Fderrickstolee%2Findex-compatibility-1-v1 Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-830/derrickstolee/index-compatibility-1-v1 Pull-Request: https://github.com/gitgitgadget/git/pull/830
-- gitgitgadget