From dc26021c43378170ff6070d632bf7ccd91fa457b Mon Sep 17 00:00:00 2001 From: Hubert Date: Fri, 16 Jul 2021 12:41:01 +0200 Subject: [PATCH] save --- src/main.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main.rs b/src/main.rs index ef4e0fa..0432daf 100644 --- a/src/main.rs +++ b/src/main.rs @@ -130,7 +130,7 @@ async fn chunk() -> HttpResponse { #[get("/git/{owner}/{repo}.git")] async fn git_main( - web::Path((owner, reponame)): web::Path<(String, String)>, + web::Path((ownername, reponame)): web::Path<(String, String)>, web::Query(GitWebQ{commit : commitnameopt, path : pathopt}) : web::Query, gitust : web::Data ) -> impl Responder { @@ -143,11 +143,11 @@ async fn git_main( Some(s) => {s} }; let commit = GitCommit::new(commitname); - let owner = Owner { name : owner}; + let owner = Owner { name : ownername}; let repo = Repository {name : reponame, owner}; let user = User { name : "Hubert".to_string()}; let gitrepo = GitRepo::new(format!("{}/{}/{}.git", &gitust.repo_root_path, &repo.owner.name, &repo.name).as_str())?; - let path : Vec<(String, String)> = rootname.split("/").map_accum("/git/".to_string() + &owner + "/" + &reponame + "/" + &commitname, |str_ref, b| { + let path : Vec<(String, String)> = rootname.split("/").map_accum("/git/".to_string() + &ownername + "/" + &reponame + "/" + &commitname, |str_ref, b| { let href = b + "/" + str_ref; ((str_ref.to_string(), href.clone()), href) }).collect(); @@ -159,11 +159,11 @@ async fn git_main( Ok(head) => head, Err(e) => panic!("failed to get head: {}", e) }; - let commit = match head.peel_to_commit() { + let commitgit = match head.peel_to_commit() { Ok(commit) => commit, Err(e) => panic!("failed to get commit: {}", e) }; - let tree = match commit.tree() { + let tree = match commitgit.tree() { Ok(tree) => tree, Err(e) => panic!("failed to get tree: {}", e) }; @@ -178,7 +178,7 @@ async fn git_main( let root = gitrepo.get_root_tree(&commit)?; // let root = GitBrowseDir::new(rootname); let browse = gitrepo.browse(&root).await; - GitMainTemplate { repo, browse : browse, root : path, user_opt : Some(user)} + Ok(GitMainTemplate { repo, browse : browse, root : path, user_opt : Some(user)}) } //#[get("/git/{owner}/{repo}.git/{path:.*}")] async fn git_proto(