Re: [RFC 00/14] convert dir.c to take an index parameter
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 6, 2017, 10:26 UTC
- Message-ID
- <xmqqmvaq702u.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <20170505195334.121856-1-bmwill@google.com>
Brandon Williams <bmwill@google.com> writes:
Show 8 quoted lines
> One of the things brought up on the list in the past few days has been > migrating away from using the index compatibility macros. One of the issues > brought up in that thread was how simply doing that conversion doesn't > eliminate the reliance on global state (specifically the_index). If one day we > want to have a 'repository object' passed around then we first need to convert > different subsystems to be prepared to handle that. This series provides a > first step, converting the code in dir.c to take a 'struct index_state' and > using that instead of implicitly using 'the_index'.
Very nicely done (I only skimmed "dir.c" in the end result and didn't go through the changes with fine toothed comb, though).
I would have done this without the first step and then instead had a final patch that only inserts a single
#define NO_THE_INDEX_COMPATIBILITY_MACROS
at the beginning of dir.c once everybody in dir.c loses the reference to all "cache" macros at the end, if I were doing this series, but it is a personal taste.
The resulting dir.c does not even refer to the_index, which is very nice.
Thanks.
Show 26 quoted lines
> Brandon Williams (14): > dir: stop using the index compatibility macros > dir: convert read_skip_worktree_file_from_index to take an index > dir: convert directory_exists_in_index to take index > dir: convert get_dtype to take index > dir: convert dir_add* to take an index > dir: convert last_exclude_matching_from_list to take an index > dir: convert is_excluded_from_list to take an index > dir: convert add_excludes to take an index > dir: convert prep_exclude to take an index > dir: convert is_excluded to take an index > dir: convert open_cached_dir to take an index > dir: convert read_directory_recursive to take an index > dir: convert read_directory to take an index > dir: convert fill_directory to take an index > > builtin/add.c | 7 +- > builtin/check-ignore.c | 3 +- > builtin/clean.c | 4 +- > builtin/grep.c | 2 +- > builtin/ls-files.c | 4 +- > dir.c | 200 ++++++++++++++++++++++++++++--------------------- > dir.h | 27 +++++-- > unpack-trees.c | 10 +-- > wt-status.c | 2 +- > 9 files changed, 151 insertions(+), 108 deletions(-)