#[non_exhaustive]pub struct FilesystemCapabilities {
pub case_insensitive: bool,
pub trust_filemode: bool,
pub symlinks: bool,
pub precomposes_unicode: bool,
}Expand description
Platform limits Git records as core.* during init.
§Examples
use grit_lib::config::init_filesystem::FilesystemCapabilities;
use std::fs;
use tempfile::TempDir;
let td = TempDir::new().expect("tempdir");
let git_dir = td.path().join(".git");
fs::create_dir_all(&git_dir).expect("mkdir");
fs::write(git_dir.join("config"), "[core]\n").expect("config");
let caps = FilesystemCapabilities::detect(&git_dir).expect("detect");
let only_case = FilesystemCapabilities::detect_case_insensitive(&git_dir).expect("case");
assert_eq!(only_case, caps.case_insensitive);Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.case_insensitive: boolWhether ref and path names are compared case-insensitively (core.ignorecase).
trust_filemode: boolWhether the executable bit on files is meaningful (core.filemode).
symlinks: boolWhether symbolic links can be created under the git directory (core.symlinks).
precomposes_unicode: boolWhether NFD and NFC spellings alias the same path (core.precomposeunicode).
Implementations§
Source§impl FilesystemCapabilities
impl FilesystemCapabilities
Sourcepub fn detect(git_dir: &Path) -> FilesystemCapabilitiesResult<Self>
pub fn detect(git_dir: &Path) -> FilesystemCapabilitiesResult<Self>
Detect all init-time filesystem capabilities under git_dir.
§Errors
Returns FilesystemCapabilitiesError::Io when a probe cannot read or touch the filesystem.
Sourcepub fn detect_case_insensitive(
git_dir: &Path,
) -> FilesystemCapabilitiesResult<bool>
pub fn detect_case_insensitive( git_dir: &Path, ) -> FilesystemCapabilitiesResult<bool>
Whether config in git_dir is visible as CoNfIg (case-insensitive git dir).
Matches Git init_db / setup.c case-insensitivity detection.
§Errors
Returns FilesystemCapabilitiesError::Io when the git directory cannot be read.
Sourcepub fn detect_trust_filemode(
git_dir: &Path,
) -> FilesystemCapabilitiesResult<bool>
pub fn detect_trust_filemode( git_dir: &Path, ) -> FilesystemCapabilitiesResult<bool>
Whether the executable bit is meaningful for git_dir/config.
Matches Git init_db filemode trustability check in setup.c.
§Errors
Returns FilesystemCapabilitiesError::Io when permissions cannot be read or toggled.
Sourcepub fn detect_symlinks_supported(
git_dir: &Path,
) -> FilesystemCapabilitiesResult<bool>
pub fn detect_symlinks_supported( git_dir: &Path, ) -> FilesystemCapabilitiesResult<bool>
Whether symbolic links can be created under git_dir.
Uses a unique path and never deletes pre-existing files (e.g. from init templates).
§Errors
Returns FilesystemCapabilitiesError::Io when the probe path cannot be created.
Sourcepub fn detect_precomposes_unicode(
git_dir: &Path,
) -> FilesystemCapabilitiesResult<bool>
pub fn detect_precomposes_unicode( git_dir: &Path, ) -> FilesystemCapabilitiesResult<bool>
Whether creating a file with an NFC filename makes the NFD spelling visible (macOS / HFS+ style).
§Errors
Returns FilesystemCapabilitiesError::Io when the probe file cannot be written.
Trait Implementations§
Source§impl Clone for FilesystemCapabilities
impl Clone for FilesystemCapabilities
impl Copy for FilesystemCapabilities
Source§impl Debug for FilesystemCapabilities
impl Debug for FilesystemCapabilities
impl Eq for FilesystemCapabilities
Source§impl PartialEq for FilesystemCapabilities
impl PartialEq for FilesystemCapabilities
impl StructuralPartialEq for FilesystemCapabilities
Auto Trait Implementations§
impl Forget for FilesystemCapabilities
impl Freeze for FilesystemCapabilities
impl RefUnwindSafe for FilesystemCapabilities
impl Send for FilesystemCapabilities
impl Sync for FilesystemCapabilities
impl Unpin for FilesystemCapabilities
impl UnsafeUnpin for FilesystemCapabilities
impl UnwindSafe for FilesystemCapabilities
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.