#[derive(Debug, Default, Clone, Copy)]
pub struct Options {
pub sparse_checkout: bool,
pub directory_patterns_only: bool,
pub write_sparse_index: bool,
}
impl Options {
pub fn sparse_mode(&self) -> Mode {
match (
self.sparse_checkout,
self.directory_patterns_only,
self.write_sparse_index,
) {
(true, true, true) => Mode::IncludeDirectoriesStoreIncludedEntriesAndExcludedDirs,
(true, true, false) => Mode::IncludeDirectoriesStoreAllEntriesSkipUnmatched,
(true, false, _) => Mode::IncludeByIgnorePatternStoreAllEntriesSkipUnmatched,
(false, _, _) => Mode::Disabled,
}
}
}
#[derive(Debug)]
pub enum Mode {
IncludeDirectoriesStoreIncludedEntriesAndExcludedDirs,
IncludeDirectoriesStoreAllEntriesSkipUnmatched,
IncludeByIgnorePatternStoreAllEntriesSkipUnmatched,
Disabled,
}