aboutsummaryrefslogtreecommitdiffstats
path: root/app/Git
diff options
context:
space:
mode:
authorLibravatar Alexander Foremny <aforemny@posteo.de>2024-03-21 05:35:00 +0100
committerLibravatar Alexander Foremny <aforemny@posteo.de>2024-03-25 07:45:59 +0100
commitf83b424bf70b7b14b0268aeeafe1b3483fced49f (patch)
tree348a60e815f4bee492f58dea903ebc380029d61f /app/Git
parentfc0afaaa273f5b5d3696df87d70d5347a13bb9ac (diff)
chore: Git -> Backend
Diffstat (limited to 'app/Git')
-rw-r--r--app/Git/CommitHash.hs42
1 files changed, 0 insertions, 42 deletions
diff --git a/app/Git/CommitHash.hs b/app/Git/CommitHash.hs
deleted file mode 100644
index f791af8..0000000
--- a/app/Git/CommitHash.hs
+++ /dev/null
@@ -1,42 +0,0 @@
-module Git.CommitHash
- ( CommitHash (..),
- toShortText,
- toText,
- toTextUnsafe,
- )
-where
-
-import Data.Binary (Binary)
-import Data.Maybe (fromMaybe)
-import Data.Text qualified as T
-import GHC.Generics (Generic)
-import Render qualified as P
-
-data CommitHash
- = WorkingTree
- | Commit T.Text
- deriving (Eq, Ord, Show, Binary, Generic)
-
-toShortText :: CommitHash -> Maybe T.Text
-toShortText = fmap (T.take 7) . toText
-
-toText :: CommitHash -> Maybe T.Text
-toText WorkingTree = Nothing
-toText (Commit hash) = Just hash
-
-toTextUnsafe :: CommitHash -> T.Text
-toTextUnsafe (Commit hash) = hash
-toTextUnsafe _ = error "toTextUnsafe: WorkingDir"
-
-instance P.Render CommitHash where
- render = P.render . P.Detailed
-
-instance P.Render (P.Detailed CommitHash) where
- render (P.Detailed commitHash) =
- P.styled [P.color P.Yellow] $
- P.render (fromMaybe "<dirty>" (toText commitHash))
-
-instance P.Render (P.Summarized CommitHash) where
- render (P.Summarized commitHash) =
- P.styled [P.color P.Yellow] $
- P.render (fromMaybe "<dirty>" (toShortText commitHash))