History

prepare attribute-group setup as far as possible. (#450)

It's not used yet, after all.

Sebastian Thiel committed 4 years ago

Commit f5e2eeb1 parent 5c11b843 files · +15 −5Browse files

Unified · Split

3 files
  1. git-repository/src/clone/checkout.rs +1 −1
  2. git-repository/src/config/cache/access.rs +10 −4
  3. src/plumbing/progress.rs +4 −0
git-repository/src/clone/checkout.rs+1−1
@@ -59,7 +59,7 @@ pub mod main_worktree { · 58 unmodified lines
59 let mut index = git_index::File::from_state(index, repo.index_path());59 let mut index = git_index::File::from_state(index, repo.index_path());
60 index.write(Default::default())?;60 index.write(Default::default())?;
61 61
62 let mut opts = repo.config.checkout_options()?;62 let mut opts = repo.config.checkout_options(repo.git_dir())?;
63 opts.destination_is_initially_empty = true;63 opts.destination_is_initially_empty = true;
64 // git_worktree::index::checkout(64 // git_worktree::index::checkout(
65 // &mut index,65 // &mut index,
git-repository/src/config/cache/access.rs+10−4
@@ -100,7 +100,10 @@ impl Cache { · 99 unmodified lines
100 /// Collect everything needed to checkout files into a worktree.100 /// Collect everything needed to checkout files into a worktree.
101 /// Note that some of the options being returned will be defaulted so safe settings, the caller might have to override them101 /// Note that some of the options being returned will be defaulted so safe settings, the caller might have to override them
102 /// depending on the use-case.102 /// depending on the use-case.
103 pub(crate) fn checkout_options(&self) -> Result<git_worktree::index::checkout::Options, checkout_options::Error> {103 pub(crate) fn checkout_options(
104 &self,
105 git_dir: &std::path::Path,
106 ) -> Result<git_worktree::index::checkout::Options, checkout_options::Error> {
104 fn checkout_thread_limit_from_config(107 fn checkout_thread_limit_from_config(
105 config: &git_config::File<'static>,108 config: &git_config::File<'static>,
106 ) -> Option<Result<usize, checkout_options::Error>> {109 ) -> Option<Result<usize, checkout_options::Error>> {
@@ -128,12 +131,15 @@ impl Cache { · 21 unmodified lines
128 .unwrap_or(default))131 .unwrap_or(default))
129 }132 }
130 133
131 fn assemble_attribute_globals(me: &Cache) -> Result<git_attributes::MatchGroup, checkout_options::Error> {134 fn assemble_attribute_globals(
135 me: &Cache,
136 _git_dir: &std::path::Path,
137 ) -> Result<git_attributes::MatchGroup, checkout_options::Error> {
132 let _attributes_file = match me.trusted_file_path("core", None, "attributesFile").transpose()? {138 let _attributes_file = match me.trusted_file_path("core", None, "attributesFile").transpose()? {
133 Some(attributes) => Some(attributes.into_owned()),139 Some(attributes) => Some(attributes.into_owned()),
134 None => me.xdg_config_path("attributes").ok().flatten(),140 None => me.xdg_config_path("attributes").ok().flatten(),
135 };141 };
136 // let group = git_attributes::MatchGroup::<git_attributes::Attributes>::from_git_dir()142 // TODO: implement git_attributes::MatchGroup::<git_attributes::Attributes>::from_git_dir(), similar to what's done for `Ignore`.
137 Ok(Default::default())143 Ok(Default::default())
138 }144 }
139 145
@@ -154,7 +160,7 @@ impl Cache { · 14 unmodified lines
154 .resolved160 .resolved
155 .string("core", None, "checkStat")161 .string("core", None, "checkStat")
156 .map_or(true, |v| v.as_ref() != "minimal"),162 .map_or(true, |v| v.as_ref() != "minimal"),
157 attribute_globals: assemble_attribute_globals(self)?,163 attribute_globals: assemble_attribute_globals(self, git_dir)?,
158 })164 })
159 }165 }
160 pub(crate) fn xdg_config_path(166 pub(crate) fn xdg_config_path(
src/plumbing/progress.rs+4−0
@@ -215,6 +215,10 @@ static GIT_CONFIG: &[Record] = &[ · 214 unmodified lines
215 deviation: None,215 deviation: None,
216 },216 },
217 },217 },
218 Record {
219 config: "core.attributesFile",
220 usage: Planned {note: Some("for checkout - it's already queried but needs building of attributes group, and of course support during checkout")},
221 },
218 Record {222 Record {
219 config: "core.abbrev",223 config: "core.abbrev",
220 usage: InModule {224 usage: InModule {