Re: [PATCH 0/5] Start of a journey: drop NO_THE_INDEX_COMPATIBILITY_MACROS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jonathan Nieder <jrnieder@xxxxxxxxx> writes:

> That is, one way to do what this series attempts would be the
> following:
>
>  1. rename variables that shadow the_index.

No question about this one.  It is a good thing to do.

>  2. add coccinelle patches (or one coccinelle patch) to
>     contrib/coccinelle implementing *_cache -> *_index migration.
>     Is there a way to do this without making it fail "make coccicheck"?

Quite honestly, I do not see much value in this, but take it merely
as my knee-jerk reaction.  The only scenario I can think of in which
dropping *_cache() macros is an improvement as the end result is
when our goal is to completely drop the singleton index_state
instance, aka "the_index".  I actually think that it may be a
worthwhile goal to eradicate "the_index".

I wonder if somebody can take a small example codepath and make it
not to rely on the existence of "the_index" from start to end?  Have
an instance of index_state on the stack of cmd_foo(), have it call
read_index() into it where it currently calls read_cache(), update
the support functions it calls so that it can pass the pointer to
its index_info throughout the callchain, and see how involved the
necessary changes of all of the above are.  Start from something
simple and small, e.g. "ls-files".  The infrastructure code updated
for such an experiment may be NO_THE_INDEX_COMPATIBILITY_MACROS
clean.

Perhaps we can remove the existence of the_index from the system by
going that route; needless to say, when that goal is achieved, by
definition *_cache() macros will be completely useless and must be
removed, as there is nobody who relies on the existence of and who
uses "the_index".

>  3. migrate library code (but not builtins) using that semantic patch

I do think this is going backwards.  The only thinng replacing
*_cache() to *_index(&the_index) buys you is newbies not having to
know both, but instead they will be exposed to the pattern of
repeated use of *_index(&the_index); i.e. reliance of the existence
of the singleton "the_index" is not reduced, but is stressed which
is a big downside when we are trying to eventually get rid of it.

Also quite honestly, I do not think we want newbies to be touching
the things that needs *_index() interface while this update is going
on.

The remainder of your enumeration goes in a direction different from
getting rid of the_index, so I do not know---I wrote the above under
the assumption that the total removal of "the_index" might be a good
thing to do, and where that assumption would lead us to (e.g. an
obvious side-effect of no longer having the_index is that *_cache()
macros cannot exist), and I am undecided if the assumption is a good
one (yet).





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]