aboutsummaryrefslogtreecommitdiffstats
path: root/app/History.hs
diff options
context:
space:
mode:
authorLibravatar Fabian Kirchner <kirchner@posteo.de>2023-10-14 00:16:46 +0200
committerLibravatar Fabian Kirchner <kirchner@posteo.de>2023-10-14 00:16:46 +0200
commit3f8d07cbbbd31ba9850208af58039024f31d56b9 (patch)
tree2b97e681af1ca6ce4400060cc8cd7de59bbe31c1 /app/History.hs
parent4b46f5fd6cb80305ce4f03b992bba68dd07d112e (diff)
get issues for all commits
Diffstat (limited to 'app/History.hs')
-rw-r--r--app/History.hs12
1 files 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")