summaryrefslogtreecommitdiffstats
path: root/vendor/gix-index/src/entry/mode.rs
blob: 1045dfd5b8b770132923c171a6e92dccbe9ea019 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use bitflags::bitflags;
bitflags! {
    /// The kind of file of an entry.
    pub struct Mode: u32 {
        /// directory (only used for sparse checkouts), equivalent to a tree, which is _excluded_ from the index via
        /// cone-mode.
        const DIR = 0o040000;
        /// regular file
        const FILE = 0o100644;
        /// regular file, executable
        const FILE_EXECUTABLE = 0o100755;
        /// Symbolic link
        const SYMLINK = 0o120000;
        /// A git commit for submodules
        const COMMIT = 0o160000;
    }
}

impl Mode {
    /// Return true if this is a sparse entry, as it points to a directory which usually isn't what an unsparse index tracks.
    pub fn is_sparse(&self) -> bool {
        *self == Self::DIR
    }
}