Skip to content
Snippets Groups Projects
Commit 6737748a authored by Georges Racinet's avatar Georges Racinet
Browse files

RHGitaly: reduced indentations

This is the removal of previously unneeded blocks kept for indentation.
parent 1dfbbf46
No related branches found
No related tags found
3 merge requests!186Merging stable branch into default,!177Merged oldstable branch for RHGitaly blob methods,!175RHGitaly Blob requests
......@@ -163,8 +163,7 @@
}
let config = self.config.clone();
{
let store_vfs = repo_store_vfs(&config, &request.repository)
.await
.map_err(default_repo_spec_error_status)?;
let store_vfs = repo_store_vfs(&config, &request.repository)
.await
.map_err(default_repo_spec_error_status)?;
......@@ -170,20 +169,20 @@
match gitlab_revision_node_prefix(&store_vfs, &request.revision)
.await
.map_err(|e| Status::internal(format!("Error resolving revision: {:?}", e)))?
{
None => {
info!("Revision not resolved");
Ok(Response::new(FindCommitResponse::default()))
}
Some(node_prefix) => {
info!("Revision resolved as {:x}", &node_prefix);
let commit = load_repo_and_then(
self.config.clone(),
request,
default_repo_spec_error_status,
move |_req, repo| {
let cl = repo.changelog().map_err(|e| {
Status::internal(format!("Could not open changelog: {:?}", e))
})?;
match gitlab_revision_node_prefix(&store_vfs, &request.revision)
.await
.map_err(|e| Status::internal(format!("Error resolving revision: {:?}", e)))?
{
None => {
info!("Revision not resolved");
Ok(Response::new(FindCommitResponse::default()))
}
Some(node_prefix) => {
info!("Revision resolved as {:x}", &node_prefix);
let commit = load_repo_and_then(
self.config.clone(),
request,
default_repo_spec_error_status,
move |_req, repo| {
let cl = repo.changelog().map_err(|e| {
Status::internal(format!("Could not open changelog: {:?}", e))
})?;
......@@ -189,15 +188,13 @@
match message::commit_for_node_prefix(&cl, node_prefix) {
// TODO discuss upstream: InvalidRevision is incorrect wording:
// it does represent both invalid input (working dir Node),
// and not found node prefixes. The latter case justifies our
// choice.
// Note that at this stage we cannot tell apart NodePrefix due to
// caller passing a hash from those read in state files (would be an
// inconsistency for them not to resolve).
Err(RevlogError::InvalidRevision) => Ok(None),
Err(e) => {
Err(Status::internal(format!("Repository corruption {:?}", e)))
}
Ok(r) => Ok(r),
match message::commit_for_node_prefix(&cl, node_prefix) {
// TODO discuss upstream: InvalidRevision is incorrect wording:
// it does represent both invalid input (working dir Node),
// and not found node prefixes. The latter case justifies our
// choice.
// Note that at this stage we cannot tell apart NodePrefix due to
// caller passing a hash from those read in state files (would be an
// inconsistency for them not to resolve).
Err(RevlogError::InvalidRevision) => Ok(None),
Err(e) => {
Err(Status::internal(format!("Repository corruption {:?}", e)))
}
......@@ -203,5 +200,7 @@
}
},
)
.await?;
Ok(r) => Ok(r),
}
},
)
.await?;
......@@ -207,6 +206,5 @@
Ok(Response::new(FindCommitResponse { commit }))
}
Ok(Response::new(FindCommitResponse { commit }))
}
}
}
......
......@@ -56,8 +56,7 @@
) -> Result<Response<RefExistsResponse>, Status> {
info!("Processing");
{
let store_vfs = repo_store_vfs(&self.config, &request.repository)
.await
.map_err(default_repo_spec_error_status)?;
let store_vfs = repo_store_vfs(&self.config, &request.repository)
.await
.map_err(default_repo_spec_error_status)?;
......@@ -63,9 +62,9 @@
let value = match map_full_ref(&store_vfs, &request.r#ref, |_tr| (), |_ka| ()).await {
Ok(()) => Ok(true),
Err(RefError::NotFound) => Ok(false),
Err(RefError::MissingRefName) => Ok(false),
Err(RefError::NotAFullRef) => Err(Status::invalid_argument("invalid refname")),
Err(RefError::GitLabStateFileError(e)) => Err(Status::internal(format!("{:?}", e))),
}?;
let value = match map_full_ref(&store_vfs, &request.r#ref, |_tr| (), |_ka| ()).await {
Ok(()) => Ok(true),
Err(RefError::NotFound) => Ok(false),
Err(RefError::MissingRefName) => Ok(false),
Err(RefError::NotAFullRef) => Err(Status::invalid_argument("invalid refname")),
Err(RefError::GitLabStateFileError(e)) => Err(Status::internal(format!("{:?}", e))),
}?;
......@@ -71,6 +70,5 @@
Ok(Response::new(RefExistsResponse { value }))
}
Ok(Response::new(RefExistsResponse { value }))
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment