1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// <FILE>src/functions/fnc_is_ignored.rs</FILE> - <DESC>Helper function to check if a path is ignored by gitignore</DESC>
// <VERS>VERSION: 1.0.1</VERS>
// <WCTX>Fixing doc tests to use no_run instead of ignore</WCTX>
// <CLOG>Changed doc example from ignore to no_run</CLOG>
use crate::;
use Path;
/// Check if a path would be ignored by gitignore patterns at the given root
///
/// This is a convenience wrapper that creates a GitignoreMatcher for the root
/// and checks if the given path is ignored according to the traversal options.
///
/// # Arguments
///
/// * `path` - The path to check (relative or absolute)
/// * `root` - The root directory to use for gitignore matching
/// * `options` - TraversalOptions controlling whether gitignore is enabled
///
/// # Returns
///
/// Returns `true` if the path matches ignore patterns, `false` otherwise.
/// If `options.gitignore` is `false`, always returns `false`.
/// If no `.gitignore` exists at the root, returns `false`.
/// Returns `false` on any I/O error (e.g., root is not a directory).
///
/// # Examples
///
/// ```no_run
/// use fast_fs::{is_ignored, TraversalOptions};
/// use std::path::Path;
///
/// let root = Path::new("/project");
/// let options = TraversalOptions::default();
/// let path = root.join("target/debug");
///
/// if is_ignored(&path, root, &options) {
/// println!("Path is ignored");
/// }
/// ```
// <FILE>src/functions/fnc_is_ignored.rs</FILE>
// <VERS>END OF VERSION: 1.0.0</VERS>