• B
    grep: optionally recurse into submodules · 0281e487
    Brandon Williams 提交于
    Allow grep to recognize submodules and recursively search for patterns in
    each submodule.  This is done by forking off a process to recursively
    call grep on each submodule.  The top level --super-prefix option is
    used to pass a path to the submodule which can in turn be used to
    prepend to output or in pathspec matching logic.
    
    Recursion only occurs for submodules which have been initialized and
    checked out by the parent project.  If a submodule hasn't been
    initialized and checked out it is simply skipped.
    
    In order to support the existing multi-threading infrastructure in grep,
    output from each child process is captured in a strbuf so that it can be
    later printed to the console in an ordered fashion.
    
    To limit the number of theads that are created, each child process has
    half the number of threads as its parents (minimum of 1), otherwise we
    potentailly have a fork-bomb.
    Signed-off-by: NBrandon Williams <bmwill@google.com>
    Signed-off-by: NJunio C Hamano <gitster@pobox.com>
    0281e487
git.c 20.1 KB