On Mon, Sep 23, 2019 at 08:07:09PM +0200, SZEDER Gábor wrote:
> Here is one more idea for microprojects:
>
> Find a group of related preprocessor constants and turn them into an
> enum. Also find where those constants are stored in variables and
> in structs and passed around as function parameters, and change the
> type of those variables, fields and parameters to the new enum.
Peff thought elsewhere in the thread that this is a good idea, so I
wanted to try out how this microproject would work in practice, and to
add a commit that we can show as a good example, and therefore set out
to convert 'cache_entry->ce_flags' to an enum... and will soon send
out a RFH patch, because I hit a snag, and am not sure what to do
about it :) Anyway:
- Finding a group of related preprocessor constants is trivial: the
common prefixes and vertically aligned values of related constants
stand out in output of 'git grep #define'. Converting them to an
enum is fairly trivial as well.
- Converting various integer types of variables, struct fields, and
function parameters to the new enum is... well, I wouldn't say
that it's hard, but it's tedious (but 'ce_flags' with about 20
related constants is perhaps the biggest we have). OTOH, it's all
fairly mechanical, and doesn't require any understanding of Git
internals. Overall I think that this is indeed a micro-sized
microproject, but...
- The bad news is that I expect that reviewing the variable, etc.
type conversions will be just as tedious, and it's quite easy to
miss a conversion or three, so I'm afraid that several rerolls
will be necessary.