aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/History/CommitHash.hs2
-rw-r--r--app/Issue/Provenance.hs8
-rw-r--r--app/Main.hs6
3 files changed, 8 insertions, 8 deletions
diff --git a/app/History/CommitHash.hs b/app/History/CommitHash.hs
index 3fcbb90..f1b8283 100644
--- a/app/History/CommitHash.hs
+++ b/app/History/CommitHash.hs
@@ -12,7 +12,7 @@ import GHC.Generics (Generic)
data CommitHash
= WorkingTree
| Commit T.Text
- deriving (Show, Binary, Generic)
+ deriving (Eq, Show, Binary, Generic)
toShortText :: CommitHash -> T.Text
toShortText WorkingTree = "<dirty>"
diff --git a/app/Issue/Provenance.hs b/app/Issue/Provenance.hs
index b5fd396..addb6fe 100644
--- a/app/Issue/Provenance.hs
+++ b/app/Issue/Provenance.hs
@@ -20,6 +20,8 @@ import Data.Time.Calendar (Day (..), toModifiedJulianDay)
import Data.Time.Clock (DiffTime, UTCTime (..), picosecondsToDiffTime)
import Exception qualified as E
import GHC.Generics (Generic)
+import History.CommitHash (CommitHash)
+import History.CommitHash qualified as C
import Process (sh)
import System.Process.Typed (setWorkingDir)
import Prelude hiding (lines)
@@ -31,9 +33,7 @@ data Provenance = Provenance
deriving (Show, Generic, Binary, Eq)
data Commit = Commit
- { -- TODO `T.Text` -> `CommitHash`
- -- @difficulty easy
- hash :: T.Text,
+ { hash :: CommitHash,
date :: UTCTime,
author :: Author
}
@@ -73,7 +73,7 @@ commitFromHEAD cwd = do
let date = read (unpack rawDate)
in pure
Commit
- { hash = hash,
+ { hash = C.Commit hash,
date = date,
author = Author authorName authorEmail
}
diff --git a/app/Main.hs b/app/Main.hs
index 4491747..2e3cae1 100644
--- a/app/Main.hs
+++ b/app/Main.hs
@@ -406,7 +406,7 @@ import Data.Text.Lazy qualified as LT
import Data.Text.Lazy.IO qualified as LT
import Data.Time.Clock (UTCTime (utctDay))
import History (getHistory)
-import History.CommitHash qualified as CH
+import History.CommitHash qualified as C
import History.IssueEvent (IssueEvent (..))
import Issue (Issue (..))
import Issue qualified as I
@@ -643,7 +643,7 @@ main = do
putDoc colorize noPager width . P.vsep $
concatMap
( \(hash, es') ->
- let shortHash = P.annotate (P.color P.Yellow) . P.pretty $ CH.toShortText hash
+ let shortHash = P.annotate (P.color P.Yellow) . P.pretty $ C.toShortText hash
in map
( \e ->
let kwd = P.annotate (P.color P.Green) . P.pretty . T.pack
@@ -688,7 +688,7 @@ main = do
++ ":"
++ show issue.start.row
++ "\nvia "
- ++ T.unpack issue.provenance.first.hash
+ ++ T.unpack (C.toText issue.provenance.first.hash)
++ "\nby "
++ T.unpack issue.provenance.first.author.name
++ " <"