Skip to content

Commit 750e268

Browse files
authored
Merge pull request #1563 from Byron/fixes
fixes
2 parents 2972ea8 + 877f4d2 commit 750e268

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

gix/src/clone/fetch/mod.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,15 @@ impl PrepareFetch {
105105
.unwrap_or_else(|| "origin".into()),
106106
};
107107

108-
let mut remote = repo
109-
.remote_at(self.url.clone())?
110-
.with_refspecs(
111-
Some(format!("+refs/heads/*:refs/remotes/{remote_name}/*").as_str()),
112-
remote::Direction::Fetch,
113-
)
114-
.expect("valid static spec");
108+
let mut remote = repo.remote_at(self.url.clone())?;
109+
if remote.fetch_specs.is_empty() {
110+
remote = remote
111+
.with_refspecs(
112+
Some(format!("+refs/heads/*:refs/remotes/{remote_name}/*").as_str()),
113+
remote::Direction::Fetch,
114+
)
115+
.expect("valid static spec");
116+
}
115117
let mut clone_fetch_tags = None;
116118
if let Some(f) = self.configure_remote.as_mut() {
117119
remote = f(remote).map_err(Error::RemoteConfiguration)?;

gix/src/remote/connection/fetch/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ where
182182
progress: impl Progress,
183183
options: ref_map::Options,
184184
) -> Result<Prepare<'remote, 'repo, T>, prepare::Error> {
185-
if self.remote.refspecs(remote::Direction::Fetch).is_empty() {
185+
if self.remote.refspecs(remote::Direction::Fetch).is_empty() && options.extra_refspecs.is_empty() {
186186
return Err(prepare::Error::MissingRefSpecs);
187187
}
188188
let ref_map = self.ref_map_inner(progress, options).await?;

0 commit comments

Comments
 (0)