From be46e4872812245e2f801ff86ef1fe90fac8db17 Mon Sep 17 00:00:00 2001 From: Samuel Tardieu Date: Wed, 1 Mar 2023 22:10:48 +0100 Subject: [PATCH] git: use our own default refspec --- lib/src/git.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/src/git.rs b/lib/src/git.rs index 9f3cdaabc9..6ddcc87e34 100644 --- a/lib/src/git.rs +++ b/lib/src/git.rs @@ -389,7 +389,9 @@ pub fn fetch( fetch_options.proxy_options(proxy_options); let callbacks = callbacks.into_git(); fetch_options.remote_callbacks(callbacks); - let refspecs = if let Some(globs) = branch_name_globs { + let refspecs = { + // If no globs have been given, import all branches + let globs = branch_name_globs.unwrap_or(&["*"]); if globs.iter().any(|g| g.contains(|c| ":^".contains(c))) { return Err(GitFetchError::InvalidGlob); } @@ -399,8 +401,6 @@ pub fn fetch( .iter() .map(|glob| format!("+refs/heads/{glob}:refs/remotes/{remote_name}/{glob}")) .collect_vec() - } else { - vec![] }; tracing::debug!("remote.download"); remote.download(&refspecs, Some(&mut fetch_options))?;