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
5959 let mut index = git_index::File::from_state(index, repo.index_path());
6060 index.write(Default::default())?;
6161
62− let mut opts = repo.config.checkout_options()?;
62+ let mut opts = repo.config.checkout_options(repo.git_dir())?;
6363 opts.destination_is_initially_empty = true;
6464 // git_worktree::index::checkout(
6565 // &mut index,
git-repository/src/config/cache/access.rs+10−4
@@ -100,7 +100,10 @@ impl Cache { · 99 unmodified lines
100100 /// Collect everything needed to checkout files into a worktree.
101101 /// Note that some of the options being returned will be defaulted so safe settings, the caller might have to override them
102102 /// 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> {
104107 fn checkout_thread_limit_from_config(
105108 config: &git_config::File<'static>,
106109 ) -> Option<Result<usize, checkout_options::Error>> {
@@ -128,12 +131,15 @@ impl Cache { · 21 unmodified lines
128131 .unwrap_or(default))
129132 }
130133
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> {
132138 let _attributes_file = match me.trusted_file_path("core", None, "attributesFile").transpose()? {
133139 Some(attributes) => Some(attributes.into_owned()),
134140 None => me.xdg_config_path("attributes").ok().flatten(),
135141 };
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`.
137143 Ok(Default::default())
138144 }
139145
@@ -154,7 +160,7 @@ impl Cache { · 14 unmodified lines
154160 .resolved
155161 .string("core", None, "checkStat")
156162 .map_or(true, |v| v.as_ref() != "minimal"),
157− attribute_globals: assemble_attribute_globals(self)?,
163+ attribute_globals: assemble_attribute_globals(self, git_dir)?,
158164 })
159165 }
160166 pub(crate) fn xdg_config_path(
src/plumbing/progress.rs+4−0
@@ -215,6 +215,10 @@ static GIT_CONFIG: &[Record] = &[ · 214 unmodified lines
215215 deviation: None,
216216 },
217217 },
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+ },
218222 Record {
219223 config: "core.abbrev",
220224 usage: InModule {