mygit

[UNMAINTAINED] A cgit/webgit alternative, written in Rust
Log | Files | Refs | README | LICENSE

commit fad192c565b12ce21ec7dc368d42787a3ff65df5
parent b73edd0d787e00e3d552040c1eeeb7b45bd223b4
Author: Johann150 <johann@qwertqwefsday.eu>
Date:   Sat,  3 Apr 2021 01:09:22 +0200

show last modified for repo overview

Diffstat:
Msrc/main.rs | 4++++
Mtemplates/index.html | 2+-
2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/main.rs b/src/main.rs @@ -685,6 +685,10 @@ mod filters { .unwrap_or_default() .to_string()) } + + pub fn last_modified(repo: &Repository) -> askama::Result<git2::Time> { + Ok(repo.head().unwrap().peel_to_commit().unwrap().committer().when()) + } } #[async_std::main] diff --git a/templates/index.html b/templates/index.html @@ -8,7 +8,7 @@ <tr> <td class="repo-link"><a href="{{repo|repo_name|urlencode_strict}}">{{repo|repo_name}}</a></td> <td class="repo-description">{{repo|description}}</td> - <!-- <td class="repo-last-updated">updated 2021-02-01</td> --> + <td class="repo-last-updated">last updated {{repo|last_modified|format_datetime("%Y-%m-%d")}}</td> </tr> {% endfor %} </table>