Struct broot::git::GitIgnoreChain
source · pub struct GitIgnoreChain { /* private fields */ }
Implementations§
source§impl GitIgnoreChain
impl GitIgnoreChain
sourcepub fn push(&mut self, id: Id<GitIgnoreFile>)
pub fn push(&mut self, id: Id<GitIgnoreFile>)
Examples found in repository?
src/git/ignore.rs (line 162)
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206
pub fn root_chain(&mut self, mut dir: &Path) -> GitIgnoreChain {
let mut chain = GitIgnoreChain::default();
loop {
let is_repo = is_repo(dir);
if is_repo {
if let Some(gif) = GitIgnoreFile::global(dir) {
chain.push(self.files.alloc(gif));
}
}
for filename in [".gitignore", ".git/info/exclude"] {
let file = dir.join(filename);
if let Ok(gif) = GitIgnoreFile::new(&file, dir) {
//debug!("pushing GIF {:#?}", &gif);
chain.push(self.files.alloc(gif));
}
}
if is_repo {
chain.in_repo = true;
break;
}
if let Some(parent) = dir.parent() {
dir = parent;
} else {
break;
}
}
chain
}
pub fn deeper_chain(&mut self, parent_chain: &GitIgnoreChain, dir: &Path) -> GitIgnoreChain {
// if the current folder is a repository, then
// we reset the chain to the root one:
// we don't want the .gitignore files of super repositories
// (see https://github.com/Canop/broot/issues/160)
let mut chain = if is_repo(dir) {
let mut chain = GitIgnoreChain::default();
if let Some(gif) = GitIgnoreFile::global(dir) {
chain.push(self.files.alloc(gif));
}
chain.in_repo = true;
chain
} else {
parent_chain.clone()
};
if chain.in_repo {
let ignore_file = dir.join(".gitignore");
if let Ok(gif) = GitIgnoreFile::new(&ignore_file, dir) {
chain.push(self.files.alloc(gif));
}
}
chain
}
Trait Implementations§
source§impl Clone for GitIgnoreChain
impl Clone for GitIgnoreChain
source§fn clone(&self) -> GitIgnoreChain
fn clone(&self) -> GitIgnoreChain
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for GitIgnoreChain
impl Debug for GitIgnoreChain
source§impl Default for GitIgnoreChain
impl Default for GitIgnoreChain
source§fn default() -> GitIgnoreChain
fn default() -> GitIgnoreChain
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl RefUnwindSafe for GitIgnoreChain
impl Send for GitIgnoreChain
impl Sync for GitIgnoreChain
impl Unpin for GitIgnoreChain
impl UnwindSafe for GitIgnoreChain
Blanket Implementations§
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<R, P> ReadPrimitive<R> for Pwhere
R: Read + ReadEndian<P>,
P: Default,
impl<R, P> ReadPrimitive<R> for Pwhere
R: Read + ReadEndian<P>,
P: Default,
source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian()
.