Skip to content

Commit ec1e550

Browse files
committed
gix index entries with tracing
1 parent 1ccbe16 commit ec1e550

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

gitoxide-core/src/repository/index/entries.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,9 @@ pub(crate) mod function {
101101
recurse_submodules: bool,
102102
out: &mut impl std::io::Write,
103103
) -> anyhow::Result<Statistics> {
104+
let _span = gix::trace::coarse!("print_entries()", git_dir = ?repo.git_dir());
104105
let (mut pathspec, index, mut cache) = init_cache(repo, attributes, pathspecs.clone())?;
106+
let mut repo_attrs = all_attrs.is_some().then(BTreeSet::default);
105107
let submodules_by_path = recurse_submodules
106108
.then(|| {
107109
repo.submodules()
@@ -142,7 +144,7 @@ pub(crate) mod function {
142144
};
143145
stats.with_attributes += usize::from(!attributes.is_empty());
144146
stats.max_attributes_per_path = stats.max_attributes_per_path.max(attributes.len());
145-
if let Some(attrs) = all_attrs.as_deref_mut() {
147+
if let Some(attrs) = repo_attrs.as_mut() {
146148
attributes.iter().for_each(|attr| {
147149
attrs.insert(attr.clone());
148150
});
@@ -232,6 +234,12 @@ pub(crate) mod function {
232234
}
233235

234236
stats.cache = cache.map(|c| *c.1.statistics());
237+
if let Some((attrs, all_attrs)) = repo_attrs.zip(all_attrs) {
238+
stats
239+
.attributes
240+
.extend(attrs.iter().map(|attr| attr.as_ref().to_string()));
241+
all_attrs.extend(attrs);
242+
}
235243
Ok(stats)
236244
}
237245

@@ -301,6 +309,7 @@ pub(crate) mod function {
301309
pub with_attributes: usize,
302310
pub max_attributes_per_path: usize,
303311
pub cache: Option<gix::worktree::stack::Statistics>,
312+
pub attributes: Vec<String>,
304313
pub submodule: Vec<(BString, Statistics)>,
305314
}
306315

0 commit comments

Comments
 (0)