diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/Git.hs | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -7,6 +7,7 @@ where import Control.Exception (finally) import Data.ByteString.Lazy.Char8 qualified as LB8 +import Data.Maybe (fromMaybe) import Data.Text qualified as T import Data.Text.Encoding qualified as T import Process (proc, sh, sh_) @@ -25,4 +26,6 @@ getCommitHashes :: IO [T.Text] getCommitHashes = T.lines . T.decodeUtf8 . LB8.toStrict <$> sh "git log --format=%H" getRootDir :: IO FilePath -getRootDir = T.unpack . T.decodeUtf8 . LB8.toStrict <$> sh (proc "git rev-parse --show-toplevel") +getRootDir = T.unpack . stripTrailingNL . T.decodeUtf8 . LB8.toStrict <$> sh (proc "git rev-parse --show-toplevel") + where + stripTrailingNL s = fromMaybe s $ T.stripSuffix "\n" s |