summaryrefslogtreecommitdiffstats
path: root/vendor/gix/src/kind.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/gix/src/kind.rs')
-rw-r--r--vendor/gix/src/kind.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/vendor/gix/src/kind.rs b/vendor/gix/src/kind.rs
new file mode 100644
index 000000000..a8213475f
--- /dev/null
+++ b/vendor/gix/src/kind.rs
@@ -0,0 +1,23 @@
+use crate::Kind;
+
+impl Kind {
+ /// Returns true if this is a bare repository, one without a work tree.
+ pub fn is_bare(&self) -> bool {
+ matches!(self, Kind::Bare)
+ }
+}
+
+impl From<gix_discover::repository::Kind> for Kind {
+ fn from(v: gix_discover::repository::Kind) -> Self {
+ match v {
+ gix_discover::repository::Kind::Submodule { .. } | gix_discover::repository::Kind::SubmoduleGitDir => {
+ Kind::WorkTree { is_linked: false }
+ }
+ gix_discover::repository::Kind::Bare => Kind::Bare,
+ gix_discover::repository::Kind::WorkTreeGitDir { .. } => Kind::WorkTree { is_linked: true },
+ gix_discover::repository::Kind::WorkTree { linked_git_dir } => Kind::WorkTree {
+ is_linked: linked_git_dir.is_some(),
+ },
+ }
+ }
+}