Trait gix_status::Pathspec

source ·
pub trait Pathspec {
    // Required methods
    fn common_prefix(&self) -> &BStr;
    fn is_included(
        &mut self,
        relative_path: &BStr,
        is_dir: Option<bool>
    ) -> bool;
}
Expand description

A trait to facilitate working working with pathspecs.

Required Methods§

source

fn common_prefix(&self) -> &BStr

Return the portion of the prefix among all of the pathspecs involved in this search, or an empty string if there is none. It doesn’t have to end at a directory boundary though, nor does it denote a directory.

Note that the common_prefix is always matched case-sensitively, and it is useful to skip large portions of input. Further, excluded pathspecs don’t participate which makes this common prefix inclusive. To work correctly though, one will have to additionally match paths that have the common prefix with that pathspec itself to assure it is not excluded.

source

fn is_included(&mut self, relative_path: &BStr, is_dir: Option<bool>) -> bool

Return true if relative_path is included in this pathspec. is_dir is true if relative_path is a directory.

Implementors§