Skip to main content

Module search

Module search 

Source
Expand description

In-repo code search: a bounded, unindexed git grep over the default branch, plus path-name matches.

Follows the JSS forge searchData / searchPage / apiSearch behaviour (cited by name only). The query is a literal, case-insensitive substring (git grep -I -n -i -F -z -e <q>): argv only, never a shell, never a regex, and the query always follows -e so it cannot be read as an option. Bounds: query 256 chars, 100 hits, 100 path matches, 5 hits per file, 200-char excerpts.

Structs§

SearchMatch
One matching line.
SearchResult
The result of one search.

Constants§

SEARCH_EXCERPT_CAP
Characters kept of each matching line.
SEARCH_HIT_CAP
Maximum returned grep hits.
SEARCH_PATH_CAP
Maximum returned path matches.
SEARCH_PER_FILE_CAP
git grep --max-count per file.
SEARCH_QUERY_CAP
Maximum query length in characters.

Functions§

parse_grep
Parse the NUL-framed git grep -z -n output (<tree>:<path>\0<line>\0<text>\n).
search_data
Run a search over branch of the bare repo at dir.