Unified · Split
| @@ -69,7 +69,7 @@ max-performance = [ "git-features/fast-sha1", · 68 unmodified lines | |||
| 69 | "git-pack/pack-cache-lru-dynamic"] | 69 | "git-pack/pack-cache-lru-dynamic"] |
| 70 | ## Re-export stability tier 2 crates for convenience and make `Repository` struct fields with types from these crates publicly accessible. | 70 | ## Re-export stability tier 2 crates for convenience and make `Repository` struct fields with types from these crates publicly accessible. |
| 71 | ## Doing so is less stable than the stability tier 1 that `git-repository` is a member of. | 71 | ## Doing so is less stable than the stability tier 1 that `git-repository` is a member of. |
| 72 | unstable = ["git-index", "git-mailmap", "git-glob", "git-credentials", "git-attributes"] | 72 | unstable = ["git-mailmap", "git-credentials"] |
| 73 | ## Print debugging information about usage of object database caches, useful for tuning cache sizes. | 73 | ## Print debugging information about usage of object database caches, useful for tuning cache sizes. |
| 74 | cache-efficiency-debug = ["git-features/cache-efficiency-debug"] | 74 | cache-efficiency-debug = ["git-features/cache-efficiency-debug"] |
| 75 | 75 | ||
| @@ -102,10 +102,10 @@ git-mailmap = { version = "^0.3.0", path = "../git-mailmap", optional = true } · 26 unmodified lines | |||
| 102 | git-features = { version = "^0.22.0", path = "../git-features", features = ["progress", "once_cell"] } | 102 | git-features = { version = "^0.22.0", path = "../git-features", features = ["progress", "once_cell"] } |
| 103 | 103 | ||
| 104 | # unstable only | 104 | # unstable only |
| 105 | git-attributes = { version = "^0.3.0", path = "../git-attributes", optional = true } | 105 | git-attributes = { version = "^0.3.0", path = "../git-attributes" } |
| 106 | git-glob = { version = "^0.3.1", path = "../git-glob", optional = true } | 106 | git-glob = { version = "^0.3.1", path = "../git-glob" } |
| 107 | git-credentials = { version = "^0.3.0", path = "../git-credentials", optional = true } | 107 | git-credentials = { version = "^0.3.0", path = "../git-credentials", optional = true } |
| 108 | git-index = { version = "^0.4.0", path = "../git-index", optional = true } | 108 | git-index = { version = "^0.4.0", path = "../git-index" } |
| 109 | git-worktree = { version = "^0.4.0", path = "../git-worktree" } | 109 | git-worktree = { version = "^0.4.0", path = "../git-worktree" } |
| 110 | 110 | ||
| 111 | signal-hook = { version = "0.3.9", default-features = false } | 111 | signal-hook = { version = "0.3.9", default-features = false } |
| @@ -242,7 +242,6 @@ impl Cache { · 241 unmodified lines | |||
| 242 | } | 242 | } |
| 243 | 243 | ||
| 244 | /// Return a path by using the `$XDF_CONFIG_HOME` or `$HOME/.config/…` environment variables locations. | 244 | /// Return a path by using the `$XDF_CONFIG_HOME` or `$HOME/.config/…` environment variables locations. |
| 245 | #[cfg_attr(not(feature = "git-index"), allow(dead_code))] | ||
| 246 | pub fn xdg_config_path( | 245 | pub fn xdg_config_path( |
| 247 | &self, | 246 | &self, |
| 248 | resource_file_name: &str, | 247 | resource_file_name: &str, |
| @@ -63,13 +63,10 @@ pub(crate) struct Cache { · 62 unmodified lines | |||
| 63 | /// The object kind to pick if a prefix is ambiguous. | 63 | /// The object kind to pick if a prefix is ambiguous. |
| 64 | pub object_kind_hint: Option<spec::parse::ObjectKindHint>, | 64 | pub object_kind_hint: Option<spec::parse::ObjectKindHint>, |
| 65 | /// If true, we are on a case-insensitive file system. | 65 | /// If true, we are on a case-insensitive file system. |
| 66 | #[cfg_attr(not(feature = "git-index"), allow(dead_code))] | ||
| 67 | pub ignore_case: bool, | 66 | pub ignore_case: bool, |
| 68 | /// The path to the user-level excludes file to ignore certain files in the worktree. | 67 | /// The path to the user-level excludes file to ignore certain files in the worktree. |
| 69 | #[cfg_attr(not(feature = "git-index"), allow(dead_code))] | ||
| 70 | pub excludes_file: Option<std::path::PathBuf>, | 68 | pub excludes_file: Option<std::path::PathBuf>, |
| 71 | /// Define how we can use values obtained with `xdg_config(…)` and its `XDG_CONFIG_HOME` variable. | 69 | /// Define how we can use values obtained with `xdg_config(…)` and its `XDG_CONFIG_HOME` variable. |
| 72 | #[cfg_attr(not(feature = "git-index"), allow(dead_code))] | ||
| 73 | xdg_config_home_env: permission::env_var::Resource, | 70 | xdg_config_home_env: permission::env_var::Resource, |
| 74 | /// Define how we can use values obtained with `xdg_config(…)`. and its `HOME` variable. | 71 | /// Define how we can use values obtained with `xdg_config(…)`. and its `HOME` variable. |
| 75 | home_env: permission::env_var::Resource, | 72 | home_env: permission::env_var::Resource, |
| @@ -126,7 +126,7 @@ · 125 unmodified lines | |||
| 126 | // This also means that their major version changes affect our major version, but that's alright as we directly expose their | 126 | // This also means that their major version changes affect our major version, but that's alright as we directly expose their |
| 127 | // APIs/instances anyway. | 127 | // APIs/instances anyway. |
| 128 | pub use git_actor as actor; | 128 | pub use git_actor as actor; |
| 129 | #[cfg(all(feature = "unstable", feature = "git-attributes"))] | 129 | #[cfg(all(feature = "unstable"))] |
| 130 | pub use git_attributes as attrs; | 130 | pub use git_attributes as attrs; |
| 131 | #[cfg(all(feature = "unstable", feature = "git-credentials"))] | 131 | #[cfg(all(feature = "unstable", feature = "git-credentials"))] |
| 132 | pub use git_credentials as credentials; | 132 | pub use git_credentials as credentials; |
| @@ -137,11 +137,11 @@ pub use git_diff as diff; · 4 unmodified lines | |||
| 137 | use git_features::threading::OwnShared; | 137 | use git_features::threading::OwnShared; |
| 138 | #[cfg(feature = "unstable")] | 138 | #[cfg(feature = "unstable")] |
| 139 | pub use git_features::{parallel, progress, progress::Progress, threading}; | 139 | pub use git_features::{parallel, progress, progress::Progress, threading}; |
| 140 | #[cfg(all(feature = "unstable", feature = "git-glob"))] | 140 | #[cfg(feature = "unstable")] |
| 141 | pub use git_glob as glob; | 141 | pub use git_glob as glob; |
| 142 | pub use git_hash as hash; | 142 | pub use git_hash as hash; |
| 143 | #[doc(inline)] | 143 | #[doc(inline)] |
| 144 | #[cfg(all(feature = "unstable", feature = "git-index"))] | 144 | #[cfg(feature = "unstable")] |
| 145 | pub use git_index as index; | 145 | pub use git_index as index; |
| 146 | pub use git_lock as lock; | 146 | pub use git_lock as lock; |
| 147 | pub use git_object as objs; | 147 | pub use git_object as objs; |
| @@ -3,7 +3,7 @@ pub use git_mailmap::*; · 2 unmodified lines | |||
| 3 | 3 | ||
| 4 | /// | 4 | /// |
| 5 | pub mod load { | 5 | pub mod load { |
| 6 | /// The error returned by [`crate::Repository::load_mailmap_into()`]. | 6 | /// The error returned by [`crate::Repository::open_mailmap_into()`]. |
| 7 | #[derive(Debug, thiserror::Error)] | 7 | #[derive(Debug, thiserror::Error)] |
| 8 | #[allow(missing_docs)] | 8 | #[allow(missing_docs)] |
| 9 | pub enum Error { | 9 | pub enum Error { |
| @@ -1,6 +1,6 @@ | |||
| 1 | impl crate::Repository { | 1 | impl crate::Repository { |
| 2 | // TODO: tests | 2 | // TODO: tests |
| 3 | /// Similar to [`load_mailmap_into()`][crate::Repository::load_mailmap_into()], but ignores all errors and returns at worst | 3 | /// Similar to [`open_mailmap_into()`][crate::Repository::open_mailmap_into()], but ignores all errors and returns at worst |
| 4 | /// an empty mailmap, e.g. if there is no mailmap or if there were errors loading them. | 4 | /// an empty mailmap, e.g. if there is no mailmap or if there were errors loading them. |
| 5 | /// | 5 | /// |
| 6 | /// This represents typical usage within git, which also works with what's there without considering a populated mailmap | 6 | /// This represents typical usage within git, which also works with what's there without considering a populated mailmap |
| @@ -68,7 +68,6 @@ impl crate::Repository { · 67 unmodified lines | |||
| 68 | /// It will use the `index.threads` configuration key to learn how many threads to use. | 68 | /// It will use the `index.threads` configuration key to learn how many threads to use. |
| 69 | /// Note that it may fail if there is no index. | 69 | /// Note that it may fail if there is no index. |
| 70 | // TODO: test | 70 | // TODO: test |
| 71 | #[cfg(feature = "git-index")] | ||
| 72 | pub fn open_index(&self) -> Result<git_index::File, worktree::open_index::Error> { | 71 | pub fn open_index(&self) -> Result<git_index::File, worktree::open_index::Error> { |
| 73 | use std::convert::{TryFrom, TryInto}; | 72 | use std::convert::{TryFrom, TryInto}; |
| 74 | let thread_limit = self | 73 | let thread_limit = self |
| @@ -6,7 +6,6 @@ use crate::head; · 5 unmodified lines | |||
| 6 | 6 | ||
| 7 | /// A worktree checkout containing the files of the repository in consumable form. | 7 | /// A worktree checkout containing the files of the repository in consumable form. |
| 8 | pub struct Worktree<'repo> { | 8 | pub struct Worktree<'repo> { |
| 9 | #[cfg_attr(not(feature = "git-index"), allow(dead_code))] | ||
| 10 | pub(crate) parent: &'repo Repository, | 9 | pub(crate) parent: &'repo Repository, |
| 11 | /// The root path of the checkout. | 10 | /// The root path of the checkout. |
| 12 | pub(crate) path: &'repo std::path::Path, | 11 | pub(crate) path: &'repo std::path::Path, |
| @@ -70,7 +70,6 @@ pub(crate) fn id(git_dir: &std::path::Path, has_common_dir: bool) -> Option<&BSt · 69 unmodified lines | |||
| 70 | pub mod proxy; | 70 | pub mod proxy; |
| 71 | 71 | ||
| 72 | /// | 72 | /// |
| 73 | #[cfg(feature = "git-index")] | ||
| 74 | pub mod open_index { | 73 | pub mod open_index { |
| 75 | use crate::bstr::BString; | 74 | use crate::bstr::BString; |
| 76 | 75 | ||
| @@ -102,7 +101,6 @@ pub mod open_index { · 25 unmodified lines | |||
| 102 | } | 101 | } |
| 103 | 102 | ||
| 104 | /// | 103 | /// |
| 105 | #[cfg(feature = "git-index")] | ||
| 106 | pub mod excludes { | 104 | pub mod excludes { |
| 107 | use std::path::PathBuf; | 105 | use std::path::PathBuf; |
| 108 | 106 | ||
| @@ -9,9 +9,10 @@ mod worktree; · 8 unmodified lines | |||
| 9 | 9 | ||
| 10 | #[test] | 10 | #[test] |
| 11 | fn size_in_memory() { | 11 | fn size_in_memory() { |
| 12 | assert_eq!( | 12 | let expected = [688, 696]; |
| 13 | std::mem::size_of::<Repository>(), | 13 | assert!( |
| 14 | 696, | 14 | expected.contains(&std::mem::size_of::<Repository>()), |
| 15 | "size of Repository shouldn't change without us noticing, it's meant to be cloned" | 15 | "size of Repository shouldn't change without us noticing, it's meant to be cloned: should have been within {:?}", |
| 16 | expected | ||
| 16 | ); | 17 | ); |
| 17 | } | 18 | } |