node: Don't fail fetch for existing repositories
If `git-fetch` returns a non-zero code on exit, we keep going in the case of an existing repository. The reason is that `git-fetch` will return an error code if any ref is rejected during the fetch. But this can happen if someone pushes conflicting `rad/sigrefs` branches for example, and the node already has a copy of that branch.
This commit is contained in:
parent
18616a16bd
commit
3e05939d14
|
|
@ -245,10 +245,22 @@ impl Worker {
|
||||||
&mut channels,
|
&mut channels,
|
||||||
) {
|
) {
|
||||||
Ok(()) => log::debug!(target: "worker", "Initial fetch for {rid} exited successfully"),
|
Ok(()) => log::debug!(target: "worker", "Initial fetch for {rid} exited successfully"),
|
||||||
Err(e) => {
|
Err(e) => match (&staging.repo, e) {
|
||||||
log::error!(target: "worker", "Initial fetch for {rid} failed: {e}");
|
// When fetching, if the error comes from `git-fetch` returning an error, we
|
||||||
return Err(e);
|
// keep going because it could be due to a rejected ref (eg. on `rad/sigrefs`),
|
||||||
}
|
// and that is non-fatal.
|
||||||
|
(fetch::StagedRepository::Fetching(_), e @ FetchError::CommandFailed { .. }) => {
|
||||||
|
log::warn!(target: "worker", "Initial fetch for {rid} returned an error: {e}");
|
||||||
|
log::warn!(target: "worker", "It's possible that some of the refs were rejected..");
|
||||||
|
}
|
||||||
|
// When cloning, any error is fatal, since we'll end up with an empty repository.
|
||||||
|
// Likewise, when fetching, if the error is coming from some other place, we
|
||||||
|
// abort the fetch.
|
||||||
|
(fetch::StagedRepository::Cloning(_) | fetch::StagedRepository::Fetching(_), e) => {
|
||||||
|
log::error!(target: "worker", "Initial fetch for {rid} failed: {e}");
|
||||||
|
return Err(e);
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
let staging = staging.into_final()?;
|
let staging = staging.into_final()?;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue