aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/Git.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/app/Git.hs b/app/Git.hs
index c72edea..af02b70 100644
--- a/app/Git.hs
+++ b/app/Git.hs
@@ -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