|
|
|
@ -60,10 +60,10 @@ impl Proxy { |
|
|
|
|
&self, |
|
|
|
|
descr: &origin::Descr, |
|
|
|
|
) -> Result<gix_hash::ObjectId, origin::SyncError> { |
|
|
|
|
let (url, branch_name) = Self::deconstruct_descr(&descr); |
|
|
|
|
let (url, branch_name) = Self::deconstruct_descr(descr); |
|
|
|
|
|
|
|
|
|
let refs_url = |
|
|
|
|
Self::construct_url(&url, "/info/refs").or_unexpected_while("constructing refs url")?; |
|
|
|
|
Self::construct_url(url, "/info/refs").or_unexpected_while("constructing refs url")?; |
|
|
|
|
|
|
|
|
|
// when fetching refs we assume that any issue indicates that the origin itself
|
|
|
|
|
// (and therefore the URL) has some kind of issue.
|
|
|
|
@ -103,10 +103,10 @@ impl Proxy { |
|
|
|
|
commit_hash: &gix_hash::ObjectId, |
|
|
|
|
) -> Result<gix_hash::ObjectId, origin::SyncError> { |
|
|
|
|
let hex = commit_hash.to_string(); |
|
|
|
|
let (url, _) = Self::deconstruct_descr(&descr); |
|
|
|
|
let (url, _) = Self::deconstruct_descr(descr); |
|
|
|
|
|
|
|
|
|
let commit_object_url = Self::construct_url( |
|
|
|
|
&url, |
|
|
|
|
url, |
|
|
|
|
format!("/objects/{}/{}", &hex[..2], &hex[2..]).as_str(), |
|
|
|
|
) |
|
|
|
|
.or_unexpected_while("constructing refs url")?; |
|
|
|
@ -152,7 +152,7 @@ impl origin::Store for Proxy { |
|
|
|
|
|
|
|
|
|
// perform the rest of the work within this closure, so we can be sure that the guard
|
|
|
|
|
// lock is released no matter what.
|
|
|
|
|
let res: Result<(), origin::SyncError> = (|| async { |
|
|
|
|
let res = async { |
|
|
|
|
let commit_hash = self.get_tip_commit_hash(&descr).await?; |
|
|
|
|
let current_tree = self.get_commit_tree(&descr, &commit_hash).await?; |
|
|
|
|
self.state |
|
|
|
@ -160,7 +160,7 @@ impl origin::Store for Proxy { |
|
|
|
|
.unwrap() |
|
|
|
|
.insert(descr.clone(), DescrState { current_tree }); |
|
|
|
|
Ok(()) |
|
|
|
|
})() |
|
|
|
|
} |
|
|
|
|
.await; |
|
|
|
|
|
|
|
|
|
self.sync_guard.lock().unwrap().remove(&descr); |
|
|
|
|