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
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.
72unstable = ["git-index", "git-mailmap", "git-glob", "git-credentials", "git-attributes"]72unstable = ["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.
74cache-efficiency-debug = ["git-features/cache-efficiency-debug"]74cache-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
102git-features = { version = "^0.22.0", path = "../git-features", features = ["progress", "once_cell"] }102git-features = { version = "^0.22.0", path = "../git-features", features = ["progress", "once_cell"] }
103 103
104# unstable only104# unstable only
105git-attributes = { version = "^0.3.0", path = "../git-attributes", optional = true }105git-attributes = { version = "^0.3.0", path = "../git-attributes" }
106git-glob = { version = "^0.3.1", path = "../git-glob", optional = true }106git-glob = { version = "^0.3.1", path = "../git-glob" }
107git-credentials = { version = "^0.3.0", path = "../git-credentials", optional = true }107git-credentials = { version = "^0.3.0", path = "../git-credentials", optional = true }
108git-index = { version = "^0.4.0", path = "../git-index", optional = true }108git-index = { version = "^0.4.0", path = "../git-index" }
109git-worktree = { version = "^0.4.0", path = "../git-worktree" }109git-worktree = { version = "^0.4.0", path = "../git-worktree" }
110 110
111signal-hook = { version = "0.3.9", default-features = false }111signal-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
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,
git-repository/src/config/mod.rs+0−3
@@ -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,
git-repository/src/lib.rs+3−3
@@ -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 their126// 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.
128pub use git_actor as actor;128pub use git_actor as actor;
129#[cfg(all(feature = "unstable", feature = "git-attributes"))]129#[cfg(all(feature = "unstable"))]
130pub use git_attributes as attrs;130pub use git_attributes as attrs;
131#[cfg(all(feature = "unstable", feature = "git-credentials"))]131#[cfg(all(feature = "unstable", feature = "git-credentials"))]
132pub use git_credentials as credentials;132pub use git_credentials as credentials;
@@ -137,11 +137,11 @@ pub use git_diff as diff; · 4 unmodified lines
137use git_features::threading::OwnShared;137use git_features::threading::OwnShared;
138#[cfg(feature = "unstable")]138#[cfg(feature = "unstable")]
139pub use git_features::{parallel, progress, progress::Progress, threading};139pub use git_features::{parallel, progress, progress::Progress, threading};
140#[cfg(all(feature = "unstable", feature = "git-glob"))]140#[cfg(feature = "unstable")]
141pub use git_glob as glob;141pub use git_glob as glob;
142pub use git_hash as hash;142pub use git_hash as hash;
143#[doc(inline)]143#[doc(inline)]
144#[cfg(all(feature = "unstable", feature = "git-index"))]144#[cfg(feature = "unstable")]
145pub use git_index as index;145pub use git_index as index;
146pub use git_lock as lock;146pub use git_lock as lock;
147pub use git_object as objs;147pub use git_object as objs;
git-repository/src/mailmap.rs+1−1
@@ -3,7 +3,7 @@ pub use git_mailmap::*; · 2 unmodified lines
3 3
4///4///
5pub mod load {5pub 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 {
git-repository/src/repository/snapshots.rs+1−1
@@ -1,6 +1,6 @@
1impl crate::Repository {1impl crate::Repository {
2 // TODO: tests2 // TODO: tests
3 /// Similar to [`load_mailmap_into()`][crate::Repository::load_mailmap_into()], but ignores all errors and returns at worst3 /// 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 mailmap6 /// 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
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: test70 // 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 = self73 let thread_limit = self
git-repository/src/types.rs+0−1
@@ -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.
8pub struct Worktree<'repo> {8pub 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,
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
70pub mod proxy;70pub mod proxy;
71 71
72///72///
73#[cfg(feature = "git-index")]
74pub mod open_index {73pub 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")]
106pub mod excludes {104pub mod excludes {
107 use std::path::PathBuf;105 use std::path::PathBuf;
108 106
git-repository/tests/repository/mod.rs+5−4
@@ -9,9 +9,10 @@ mod worktree; · 8 unmodified lines
9 9
10#[test]10#[test]
11fn size_in_memory() {11fn 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}

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