~/selfhut

1830bc1afa9953e4a8bdba3839bd6fcb6b33967d — Arthur Melton b961c5bf 2 years ago
cargo fmt
3 files changed, 7 insertions(+), 7 deletions(-)

M src/git/get_all.rs
M src/repository/archive.rs
M src/repository/commit.rs
M src/git/get_all.rs => src/git/get_all.rs +3 -3
@@ 1,9 1,9 @@

use crate::config::CONFIG;
use git2::ObjectType;
use humansize::{format_size, DECIMAL};
use serde_derive::Serialize;

use std::path::PathBuf;




pub fn files(repo: String, branch: String, path: String) -> Option<Vec<String>> {
    if branch.contains(":") {

M src/repository/archive.rs => src/repository/archive.rs +2 -2
@@ 2,8 2,8 @@ use crate::config::CONFIG;

use crate::git::get_all::files;
use tar::{Builder, Header};
use rocket::response::stream::ByteStream;
use rocket::futures::stream::{repeat, StreamExt};
use rocket::tokio::time::{self, Duration};



#[get("/<repo>/archive/<oid>", rank = 2)]
pub fn archive(repo: String, oid: String) -> ByteStream![Vec<u8>] {

M src/repository/commit.rs => src/repository/commit.rs +2 -2
@@ 123,10 123,10 @@ pub fn commit(repo: String, oid: String) -> Option<Template> {

pub fn patch(repo: String, oid: String) -> Option<String> {
    let mut repo_path = CONFIG.git_location.clone();
    repo_path.push(format!("{}.git", repo));
    let repo_clone = repo.clone();
    let _repo_clone = repo.clone();
    let repo = git2::Repository::open(repo_path).ok()?;
    let commit = repo.find_commit(git2::Oid::from_str(&oid).ok()?).ok()?;
    let diff = diffs(commit, &repo)?;
    let _diff = diffs(commit, &repo)?;
    None
}