MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / from_file

Method from_file

atomic-repository/src/ignore.rs:142–161  ·  view source on GitHub ↗

Load ignore rules from a specific file only. This is useful for testing or when you want to use a custom ignore file. # Arguments `repo_root` - The root directory of the repository `ignore_path` - Path to the ignore file # Returns An `IgnoreRules` instance with patterns from the specified file.

(repo_root: &Path, ignore_path: &Path)

Source from the content-addressed store, hash-verified

140 ///
141 /// An `IgnoreRules` instance with patterns from the specified file.
142 pub fn from_file(repo_root: &Path, ignore_path: &Path) -> IgnoreResult<Self> {
143 let local = if ignore_path.exists() {
144 let mut builder = GitignoreBuilder::new(repo_root);
145 if let Some(err) = builder.add(ignore_path) {
146 return Err(IgnoreError::ParseError {
147 path: ignore_path.display().to_string(),
148 details: err.to_string(),
149 });
150 }
151 builder.build().ok()
152 } else {
153 None
154 };
155
156 Ok(Self {
157 global: None,
158 local,
159 repo_root: repo_root.to_path_buf(),
160 })
161 }
162
163 /// Check if a path should be ignored.
164 ///

Callers

nothing calls this directly

Calls 4

displayMethod · 0.80
existsMethod · 0.45
addMethod · 0.45
buildMethod · 0.45

Tested by

no test coverage detected