From 3f8d07cbbbd31ba9850208af58039024f31d56b9 Mon Sep 17 00:00:00 2001 From: Fabian Kirchner Date: Sat, 14 Oct 2023 00:16:46 +0200 Subject: get issues for all commits --- app/History.hs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/History.hs b/app/History.hs index 20e51ab..c3b3699 100644 --- a/app/History.hs +++ b/app/History.hs @@ -9,7 +9,8 @@ import Data.ByteString.Lazy.Char8 qualified as L8 import Data.List (intercalate) import Data.Maybe (catMaybes) import Data.String (fromString) -import Data.Text (Text, unpack) +import Data.Text (Text, lines, unpack) +import Data.Text.Encoding (decodeUtf8) import Issue (Issue (..), fromMatch) import Issue.Filter (Filter, applyFilter) import Process (quote, sh, sh_) @@ -20,6 +21,8 @@ import System.IO.Temp (withSystemTempDirectory) import Text.Printf (printf) import TreeGrepper.Match qualified as G import TreeGrepper.Result qualified as G +import Prelude hiding (lines) +import Prelude qualified as Prelude data UnknownFileExtension = UnknownFileExtension { extension :: String @@ -36,8 +39,9 @@ data InvalidTreeGrepperResult = InvalidTreeGrepperResult instance Exception InvalidTreeGrepperResult listIssues :: [Filter] -> [FilePath] -> IO [Issue] -listIssues filters files = - listIssuesOf "HEAD" filters files +listIssues filters files = do + commits <- fmap (lines . decodeUtf8 . L8.toStrict) $ sh ("git log --format=%H") + fmap head $ mapM (\commit -> listIssuesOf commit filters files) commits listIssuesOf :: Text -> [Filter] -> [FilePath] -> IO [Issue] listIssuesOf commit filters files = do @@ -60,7 +64,7 @@ listIssuesOf commit filters files = do getFiles :: [String] -> IO [FilePath] getFiles files = - lines . L8.unpack + Prelude.lines . L8.unpack <$> sh ( fromString ( (printf "git ls-files --cached --exclude-standard --other%s") -- cgit v1.2.3