summaryrefslogtreecommitdiffstats
path: root/vendor/gix-index/src/entry/mode.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/gix-index/src/entry/mode.rs')
-rw-r--r--vendor/gix-index/src/entry/mode.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/vendor/gix-index/src/entry/mode.rs b/vendor/gix-index/src/entry/mode.rs
new file mode 100644
index 000000000..1045dfd5b
--- /dev/null
+++ b/vendor/gix-index/src/entry/mode.rs
@@ -0,0 +1,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
+ }
+}