diff options
author | Alexander Foremny <aforemny@posteo.de> | 2023-11-07 22:00:43 +0100 |
---|---|---|
committer | Alexander Foremny <aforemny@posteo.de> | 2023-11-07 22:01:55 +0100 |
commit | 8ee9303043fafe916fe59e43895a1753882d5139 (patch) | |
tree | 6034ffb60da73495d8b8b5e8333bbf135f1a91ff /app | |
parent | 8d1646b6545ceeda6fc7a57356fd6e72e66d39b9 (diff) |
fix `getRootDir` returning wrong path
Check for `../anissue\n` having been created by invocations prior to
this fix.
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 |