This commit is contained in:
Hubert 2021-07-16 12:41:01 +02:00
parent ecd0837490
commit dc26021c43
1 changed files with 6 additions and 6 deletions

View File

@ -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<GitWebQ>,
gitust : web::Data<Gitust>
) -> 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(