History

address auto-review

The new preflight `ref_map_by_ref()` call will implicitly add the tag refspec `refs/tags/*:refs/tags/*` based on the remote’s current `fetch_tags` setting, which can cause `ls-refs` to enumerate *all* tags just to resolve a single `ref_name`. This defeats the shallow single-ref optimization on repos with many tags. Consider temporarily setting `remote.fetch_tags` to `Tags::None` around this lookup (similar to the HEAD-lookup path below) so prefix filtering only requests the DWIM-expanded candidates for the requested name, rather than all tags.

GPT 5.5 committed 5 months ago

Commit 0c1645a1 parent 7734fb01 file · +3 −0Browse files

Unified · Split

gix/src/clone/fetch/mod.rs+3−0
@@ -116,6 +116,7 @@ impl PrepareFetch { · 115 unmodified lines
116 let target_ref = if use_single_branch_for_shallow {116 let target_ref = if use_single_branch_for_shallow {
117 // Determine target branch from user-specified ref_name or default branch117 // Determine target branch from user-specified ref_name or default branch
118 if let Some(ref_name) = &self.ref_name {118 if let Some(ref_name) = &self.ref_name {
119 let prev_tags = std::mem::replace(&mut remote.fetch_tags, remote::fetch::Tags::None);
119 let mut connection = remote.connect(remote::Direction::Fetch).await?;120 let mut connection = remote.connect(remote::Direction::Fetch).await?;
120 if let Some(f) = self.configure_connection.as_mut() {121 if let Some(f) = self.configure_connection.as_mut() {
121 f(&mut connection).map_err(Error::RemoteConnection)?;122 f(&mut connection).map_err(Error::RemoteConnection)?;
@@ -134,6 +135,8 @@ impl PrepareFetch { · 12 unmodified lines
134 )135 )
135 .await?;136 .await?;
136 let (_target, full_ref_name) = util::find_custom_refname(&refmap, ref_name)?;137 let (_target, full_ref_name) = util::find_custom_refname(&refmap, ref_name)?;
138 drop(connection);
139 remote.fetch_tags = prev_tags;
137 Some(full_ref_name.try_into()?)140 Some(full_ref_name.try_into()?)
138 } else {141 } else {
139 // For shallow clones without a specified ref, we need to determine the ref to clone.142 // For shallow clones without a specified ref, we need to determine the ref to clone.