Eric Sunshine <sunshine@xxxxxxxxxxxxxx> writes: > On Sat, Feb 22, 2014 at 4:17 AM, Thomas Rast <tr@xxxxxxxxxxxxx> wrote: >> -static void lazy_init_name_hash(struct index_state *istate) >> +void init_name_hash(struct index_state *istate, int force_dir_hash) >> { >> int nr; >> >> if (istate->name_hash_initialized) >> return; >> + >> + istate->has_dir_hash = force_dir_hash || ignore_case; > > This is getting a bit convoluted. Refactoring lazy_init_name_hash() > into two functions would eliminate the complexity. For instance: > > void init_name_hash(struct index_state *istate) > { > ...pure initialization code... > } > > static void init_name_hash_if_needed(struct index_state *istate) > { > if (ignore_case && !istate->name_hash_initialized) > init_name_hash(istate); > } > > The two existing callers of lazy_init_name_hash() in name-hash.c, > which rely upon the lazy/ignore-case logic, would invoke the static > init_name_hash_if_needed(). > > The new caller in patch 8/8, which knows explicitly if and when it > wants the hash initialized can invoke the public init_name_hash(). That unfortunately doesn't really help because the conditional part only affects the dir hash. Callers request the name hash for other reasons, but we only do the dir hashing when ignore_case is in effect. So it's not simply about overriding lazy initialization, but about choosing to trigger a specific subpart of the initialization. -- Thomas Rast tr@xxxxxxxxxxxxx -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html