History

Make `git-index` non-optional and part of the standard setup. (#427)

Sebastian Thiel committed 4 years ago

Commit c2e84a41 parent ebb788c10 files · +14 −21Browse files

Unified · Split

10 files
  1. git-repository/Cargo.toml +4 −4
  2. git-repository/src/config/cache.rs +0 −1
  3. git-repository/src/config/mod.rs +0 −3
  4. git-repository/src/lib.rs +3 −3
  5. git-repository/src/mailmap.rs +1 −1
  6. git-repository/src/repository/snapshots.rs +1 −1
  7. git-repository/src/repository/worktree.rs +0 −1
  8. git-repository/src/types.rs +0 −1
  9. git-repository/src/worktree/mod.rs +0 −2
  10. git-repository/tests/repository/mod.rs +5 −4
git-repository/Cargo.toml+4−4
@@ -69,7 +69,7 @@ max-performance = [ "git-features/fast-sha1", · 68 unmodified lines
6969 "git-pack/pack-cache-lru-dynamic"]
7070 ## Re-export stability tier 2 crates for convenience and make `Repository` struct fields with types from these crates publicly accessible.
7171 ## 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"]
7373 ## Print debugging information about usage of object database caches, useful for tuning cache sizes.
7474 cache-efficiency-debug = ["git-features/cache-efficiency-debug"]
7575
@@ -102,10 +102,10 @@ git-mailmap = { version = "^0.3.0", path = "../git-mailmap", optional = true } · 26 unmodified lines
102102 git-features = { version = "^0.22.0", path = "../git-features", features = ["progress", "once_cell"] }
103103
104104 # unstable only
105−git-attributes = { version = "^0.3.0", path = "../git-attributes", optional = true }
106−git-glob = { version = "^0.3.1", path = "../git-glob", optional = true }
105+git-attributes = { version = "^0.3.0", path = "../git-attributes" }
106+git-glob = { version = "^0.3.1", path = "../git-glob" }
107107 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" }
109109 git-worktree = { version = "^0.4.0", path = "../git-worktree" }
110110
111111 signal-hook = { version = "0.3.9", default-features = false }
git-repository/src/config/cache.rs+0−1
@@ -242,7 +242,6 @@ impl Cache { · 241 unmodified lines
242242 }
243243
244244 /// 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))]
246245 pub fn xdg_config_path(
247246 &self,
248247 resource_file_name: &str,
git-repository/src/config/mod.rs+0−3
@@ -63,13 +63,10 @@ pub(crate) struct Cache { · 62 unmodified lines
6363 /// The object kind to pick if a prefix is ambiguous.
6464 pub object_kind_hint: Option<spec::parse::ObjectKindHint>,
6565 /// If true, we are on a case-insensitive file system.
66− #[cfg_attr(not(feature = "git-index"), allow(dead_code))]
6766 pub ignore_case: bool,
6867 /// 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))]
7068 pub excludes_file: Option<std::path::PathBuf>,
7169 /// 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))]
7370 xdg_config_home_env: permission::env_var::Resource,
7471 /// Define how we can use values obtained with `xdg_config(…)`. and its `HOME` variable.
7572 home_env: permission::env_var::Resource,
git-repository/src/lib.rs+3−3
@@ -126,7 +126,7 @@ · 125 unmodified lines
126126 // This also means that their major version changes affect our major version, but that's alright as we directly expose their
127127 // APIs/instances anyway.
128128 pub use git_actor as actor;
129−#[cfg(all(feature = "unstable", feature = "git-attributes"))]
129+#[cfg(all(feature = "unstable"))]
130130 pub use git_attributes as attrs;
131131 #[cfg(all(feature = "unstable", feature = "git-credentials"))]
132132 pub use git_credentials as credentials;
@@ -137,11 +137,11 @@ pub use git_diff as diff; · 4 unmodified lines
137137 use git_features::threading::OwnShared;
138138 #[cfg(feature = "unstable")]
139139 pub use git_features::{parallel, progress, progress::Progress, threading};
140−#[cfg(all(feature = "unstable", feature = "git-glob"))]
140+#[cfg(feature = "unstable")]
141141 pub use git_glob as glob;
142142 pub use git_hash as hash;
143143 #[doc(inline)]
144−#[cfg(all(feature = "unstable", feature = "git-index"))]
144+#[cfg(feature = "unstable")]
145145 pub use git_index as index;
146146 pub use git_lock as lock;
147147 pub use git_object as objs;
git-repository/src/mailmap.rs+1−1
@@ -3,7 +3,7 @@ pub use git_mailmap::*; · 2 unmodified lines
33
44 ///
55 pub mod load {
6− /// The error returned by [`crate::Repository::load_mailmap_into()`].
6+ /// The error returned by [`crate::Repository::open_mailmap_into()`].
77 #[derive(Debug, thiserror::Error)]
88 #[allow(missing_docs)]
99 pub enum Error {
git-repository/src/repository/snapshots.rs+1−1
@@ -1,6 +1,6 @@
11 impl crate::Repository {
22 // 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
44 /// an empty mailmap, e.g. if there is no mailmap or if there were errors loading them.
55 ///
66 /// This represents typical usage within git, which also works with what's there without considering a populated mailmap
git-repository/src/repository/worktree.rs+0−1
@@ -68,7 +68,6 @@ impl crate::Repository { · 67 unmodified lines
6868 /// It will use the `index.threads` configuration key to learn how many threads to use.
6969 /// Note that it may fail if there is no index.
7070 // TODO: test
71− #[cfg(feature = "git-index")]
7271 pub fn open_index(&self) -> Result<git_index::File, worktree::open_index::Error> {
7372 use std::convert::{TryFrom, TryInto};
7473 let thread_limit = self
git-repository/src/types.rs+0−1
@@ -6,7 +6,6 @@ use crate::head; · 5 unmodified lines
66
77 /// A worktree checkout containing the files of the repository in consumable form.
88 pub struct Worktree<'repo> {
9− #[cfg_attr(not(feature = "git-index"), allow(dead_code))]
109 pub(crate) parent: &'repo Repository,
1110 /// The root path of the checkout.
1211 pub(crate) path: &'repo std::path::Path,
git-repository/src/worktree/mod.rs+0−2
@@ -70,7 +70,6 @@ pub(crate) fn id(git_dir: &std::path::Path, has_common_dir: bool) -> Option<&BSt · 69 unmodified lines
7070 pub mod proxy;
7171
7272 ///
73−#[cfg(feature = "git-index")]
7473 pub mod open_index {
7574 use crate::bstr::BString;
7675
@@ -102,7 +101,6 @@ pub mod open_index { · 25 unmodified lines
102101 }
103102
104103 ///
105−#[cfg(feature = "git-index")]
106104 pub mod excludes {
107105 use std::path::PathBuf;
108106
git-repository/tests/repository/mod.rs+5−4
@@ -9,9 +9,10 @@ mod worktree; · 8 unmodified lines
99
1010 #[test]
1111 fn size_in_memory() {
12− assert_eq!(
13− std::mem::size_of::<Repository>(),
14− 696,
15− "size of Repository shouldn't change without us noticing, it's meant to be cloned"
12+ let expected = [688, 696];
13+ assert!(
14+ expected.contains(&std::mem::size_of::<Repository>()),
15+ "size of Repository shouldn't change without us noticing, it's meant to be cloned: should have been within {:?}",
16+ expected
1617 );
1718 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t