Skip to content

Commit fa39c09

Browse files
committed
Fetch only the master branch when cloning the index
Fixes: #3630
1 parent 6efd0b7 commit fa39c09

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/git.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,14 @@ impl Repository {
153153

154154
let repository = git2::build::RepoBuilder::new()
155155
.fetch_options(Self::fetch_options(&repository_config.credentials))
156+
.remote_create(|repo, name, url| {
157+
// Manually create the remote with a fetchspec, to avoid cloning old snaphots
158+
repo.remote_with_fetch(
159+
name,
160+
url,
161+
&format!("refs/heads/master:refs/remotes/{}/master", name),
162+
)
163+
})
156164
.clone(
157165
repository_config.index_location.as_str(),
158166
checkout_path.path(),

0 commit comments

Comments
 (0)