node: Make sure not to prune on initial fetch
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
This commit is contained in:
parent
59ccfdda77
commit
d7a2520ad3
|
|
@ -380,6 +380,7 @@ impl<'r> WriteRepository<'r> for Repository {
|
||||||
let staging_repo = builder
|
let staging_repo = builder
|
||||||
.bare(true)
|
.bare(true)
|
||||||
// TODO: Comment
|
// TODO: Comment
|
||||||
|
// TODO: Due to this, I think we'll have to run GC when there is a failure.
|
||||||
.clone_local(git2::build::CloneLocal::Local)
|
.clone_local(git2::build::CloneLocal::Local)
|
||||||
.clone(
|
.clone(
|
||||||
&git::Url {
|
&git::Url {
|
||||||
|
|
@ -391,9 +392,13 @@ impl<'r> WriteRepository<'r> for Repository {
|
||||||
&path,
|
&path,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
// In case we fetch an invalid update, we want to make sure nothing is deleted.
|
||||||
|
let mut opts = git2::FetchOptions::default();
|
||||||
|
opts.prune(git2::FetchPrune::Off);
|
||||||
|
|
||||||
staging_repo
|
staging_repo
|
||||||
.remote_anonymous(&url)?
|
.remote_anonymous(&url)?
|
||||||
.fetch(refs, None, None)?;
|
.fetch(refs, Some(&mut opts), None)?;
|
||||||
// TODO: Comment
|
// TODO: Comment
|
||||||
Repository::from(staging_repo).verify()?;
|
Repository::from(staging_repo).verify()?;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue