🐙 Templated web page generator for your git repositories
git clone https://github.com/m-col/gitja
Files | Refs | Readme | License

Commit b264de6146955f6b4f9831bfc363afb61c35d72c
Parent: 7a738442e31e91061f795d67a3b34014a096cf23
Author: mcol <mcol@posteo.net>
Date: 2021-11-23 13:07:13 +0000
Committer: mcol <mcol@posteo.net>
Committed: 2021-11-23 13:07:13 +0000

make parent commit sha available on commits

Closes #4

templates/commit.html Modified

@@ -8,7 +8,8 @@
 {% include "repo-table-header.html.include" %}
 
 <div id="content">
-  <pre><b>commit</b> <a href="{{ host }}/{{ name }}/commit/{{ commit.id }}.html">{{ commit.id }}</a>
+  <pre><b>Commit</b> <a href="{{ host }}/{{ name }}/commit/{{ commit.id }}.html">{{ commit.id }}</a>
+<b>Parent:</b> <a href="{{ host }}/{{ name }}/commit/{{ commit.parent }}.html">{{ commit.parent }}</a>
 <b>Author:</b> {{ commit.author }} &lt;<a href="mailto:{{ commit.author_email }}">{{ commit.author_email }}</a>&gt;
 <b>Date:</b> {{ commit.authored }}
 <b>Committer:</b> {{ commit.committer }} &lt;<a href="mailto:{{ commit.committer_email }}">{{ commit.committer_email }}</a>&gt;

src/Types.hs Modified

@@ -12,6 +12,7 @@
 
 import Data.ByteString.UTF8 (toString)
 import Data.Default (def)
+import Data.Maybe (listToMaybe)
 import Data.Tagged (untag)
 import Data.Text (Text, pack, strip)
 import qualified Data.Text as T
@@ -76,6 +77,7 @@
     "authored" -> Just . toGVal . show . signatureWhen . commitAuthor $ commit
     "committed" -> Just . toGVal . show . signatureWhen . commitCommitter $ commit
     "encoding" -> Just . toGVal . strip . commitEncoding $ commit
+    "parent" -> toGVal . show . untag <$> (listToMaybe . commitParents $ commit)
     _ -> Nothing
 
 {-