On Sat, Sep 28, 2019 at 12:24 AM Junio C Hamano <gitster@xxxxxxxxx> wrote: > > Matheus Tavares Bernardino <matheus.bernardino@xxxxxx> writes: > > > Right, this would be the best way of doing it. However, I think this > > is not how it's currently implemented. I if correctly understood the > > code in this call chain: > > > > grep_source_load_driver() > userdiff_find_by_path() > > > git_check_attr() > collect_some_attrs() > prepare_attr_stack() > > > bootstrap_attr_stack() > > > > it seems that the whole stack is being rebuild for every path (even > > for paths descending in the same superproject or submodule). > > bootstrap is guarded with "if (*stack) return;" and prepare knows to > rewind to the common level and push down the new ones, no? Right, I've somehow missed this guard and the fact that 'check' is static at userdiff_find_by_path() so the stack is persistent. Thanks for pointing this out and sorry for the noise.