This needed to be adjusted to handle a sharded homebrew/core and repositories with formulae in the root.
Library
This directory contains all the code run by the official brew command in Homebrew and all formulae (package descriptions) in taps (repositories containing formulae) in Taps subdirectories.