~aw/patches

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
3 2

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

Johann Galle
Details
Message ID
<20210321155513.1389-1-johann@qwertqwefsday.eu>
DKIM signature
pass
Download raw message
Patch: +1 -1
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

Johann Galle
Details
Message ID
<20210321155513.1389-2-johann@qwertqwefsday.eu>
In-Reply-To
<20210321155513.1389-1-johann@qwertqwefsday.eu> (view parent)
DKIM signature
pass
Download raw message
Patch: +0 -32
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

Johann Galle
Details
Message ID
<20210321155513.1389-3-johann@qwertqwefsday.eu>
In-Reply-To
<20210321155513.1389-1-johann@qwertqwefsday.eu> (view parent)
DKIM signature
pass
Download raw message
Patch: +4 -5
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

Re: [PATCH mygit v1 3/3] resolve warnings

Details
Message ID
<CA36QFRCINZN.FEBX3NX5AM4N@debian-alex>
In-Reply-To
<20210321155513.1389-3-johann@qwertqwefsday.eu> (view parent)
DKIM signature
fail
Download raw message
DKIM signature: fail
Thank you!

On Sun Mar 21, 2021 at 8:55 AM PDT, Johann Galle wrote:
> 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
Reply to thread Export thread (mbox)