pub struct Pickaxe { /* private fields */ }Expand description
Compiled pickaxe filter for crate::rev_list::rev_list.
Implementations§
Source§impl Pickaxe
impl Pickaxe
Sourcepub fn occurrences(needle: impl Into<String>) -> Self
pub fn occurrences(needle: impl Into<String>) -> Self
-S / occurrence-count pickaxe (literal string unless Self::pickaxe_regex).
Sourcepub fn line_grep(pattern: &str, ignore_case: bool) -> Result<Self, PickaxeError>
pub fn line_grep(pattern: &str, ignore_case: bool) -> Result<Self, PickaxeError>
-G / line-level regex pickaxe (Git REG_EXTENDED | REG_NEWLINE).
§Errors
Returns PickaxeError::InvalidPattern when the pattern does not compile.
Sourcepub fn ignore_case(self, on: bool) -> Self
pub fn ignore_case(self, on: bool) -> Self
Case-insensitive matching (Git -i / --regexp-ignore-case).
Sourcepub fn pickaxe_regex(self, on: bool) -> Self
pub fn pickaxe_regex(self, on: bool) -> Self
Treat -S needle as an ERE (--pickaxe-regex; only valid with occurrence mode).
Sourcepub fn build(self) -> Result<Self, PickaxeError>
pub fn build(self) -> Result<Self, PickaxeError>
Finalize a pickaxe built with Self::occurrences (compiles ERE when requested).
§Errors
Returns PickaxeError::InvalidPattern when --pickaxe-regex is set and the needle
does not compile as ERE.
Shared handle for crate::rev_list::RevListOptions.
Sourcepub fn matches_commit(
&self,
repo: &Repository,
commit_oid: ObjectId,
paths: &[String],
renames: RenameDetection,
config: &ConfigSet,
) -> Result<bool>
pub fn matches_commit( &self, repo: &Repository, commit_oid: ObjectId, paths: &[String], renames: RenameDetection, config: &ConfigSet, ) -> Result<bool>
Returns true when commit would be kept by git log with this pickaxe vs its first parent.
Matches Git’s order of work: the tree diff is limited to paths first, then deleted and
added paths are paired as renames per renames, and only then is each file pair tested.
A rename whose old and new file hold the same number of matches (-S), or whose diff
changes no matching line (-G), is therefore not a change. A file moved into the
pathspec from outside it is an addition, since its old path was never diffed.
Merge commits are skipped (Git default without combined merge diffs). Non-merge commits
compare to the first parent only. Binary files are skipped for -G; -S searches binary
blobs.
§Parameters
paths— repository-relative pathspecs limiting the diff; empty means the whole tree.renames— rename pairing; callers following Git userenames_from_config(diff.renames).config— suppliesdiff.renameLimitand rename-scoring thread settings.
§Errors
Propagates object read and diff errors.