~aw/patches

mygit: correct closing div tag v1 APPLIED

Johann Galle
Johann Galle: 3
 correct closing div tag
 remove dead code
 resolve warnings

 3 files changed, 5 insertions(+), 38 deletions(-)
Thank you!

On Sun Mar 21, 2021 at 8:55 AM PDT, Johann Galle wrote:
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~aw/patches/patches/21341/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH mygit v1 1/3] correct closing div tag Export this patch

Johann Galle
From: Johann150 <johann@qwertqwefsday.eu>

---
 templates/repo.html | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/templates/repo.html b/templates/repo.html
index a41e539..3943543 100644
--- a/templates/repo.html
+++ b/templates/repo.html
@@ -7,6 +7,6 @@
    {{ readme_text|safe }}
  {% else -%}
    <em>(no README)</em>
  </div>
  {%- endif %}
  </div>
{% endblock %}
-- 
2.20.1

[PATCH mygit v1 2/3] remove dead code Export this patch

Johann Galle
From: Johann150 <johann@qwertqwefsday.eu>

---
 src/templates.rs | 32 --------------------------------
 1 file changed, 32 deletions(-)
 delete mode 100644 src/templates.rs

diff --git a/src/templates.rs b/src/templates.rs
deleted file mode 100644
index 59f90e9..0000000
--- a/src/templates.rs
@@ -1,32 +0,0 @@
pub use askama;
pub use tide;

use askama::*;
use tide::{http::Mime, Body, Response};

pub fn try_into_body<T: Template>(t: &T, ext: &str) -> Result<Body> {
    let string = t.render()?;
    let mut body = Body::from_string(string);

    if let Some(mime) = Mime::from_extension(ext) {
        body.set_mime(mime);
    }

    Ok(body)
}

pub fn into_response<T: Template>(t: &T, ext: &str) -> Response {
    match try_into_body(t, ext) {
        Ok(body) => {
            let mut response = Response::new(200);
            response.set_body(body);
            response
        }

        Err(error) => {
            let mut response = Response::new(500);
            response.set_error(error);
            response
        }
    }
}
-- 
2.20.1

[PATCH mygit v1 3/3] resolve warnings Export this patch

Johann Galle
From: Johann150 <johann@qwertqwefsday.eu>

---
 src/main.rs | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/main.rs b/src/main.rs
index d2f390a..7bbc287 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,16 +1,15 @@
use anyhow::Result;
use askama::Template;
use git2::{
    Commit, Diff, DiffDelta, DiffFormat, Object, Oid, Reference, Repository, Tree, TreeEntry,
    Commit, Diff, DiffDelta, Reference, Repository, Tree, TreeEntry,
};
use once_cell::sync::Lazy;
use pico_args;
use serde::Deserialize;
use std::fs;
use std::path::Path;
use std::str;
use syntect::highlighting::{Color, ThemeSet};
use syntect::parsing::{SyntaxReference, SyntaxSet};
use syntect::highlighting::ThemeSet;
use syntect::parsing::SyntaxSet;
use tide::Request;

#[derive(Deserialize, Debug)]
@@ -79,7 +78,7 @@ fn args() -> Config {
    let config_filename = pargs
        .opt_value_from_str(["-c", "--config"])
        .unwrap()
        .unwrap_or("mygit.toml".to_string());
        .unwrap_or_else(|| "mygit.toml".to_string());

    let toml_text = fs::read_to_string(&config_filename).unwrap_or_else(|_| {
        tide::log::warn!(
-- 
2.20.1
Thank you!

On Sun Mar 21, 2021 at 8:55 AM PDT, Johann Galle wrote: