diff options
Diffstat (limited to 'app/Issue.hs')
-rw-r--r-- | app/Issue.hs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/app/Issue.hs b/app/Issue.hs index f7227f1..c9d18f8 100644 --- a/app/Issue.hs +++ b/app/Issue.hs @@ -8,9 +8,8 @@ module Issue (Issue (..), Provenance (..), fromMatch, id) where import Data.Binary (Binary, get, put) import Data.ByteString.Lazy (toStrict) -import Data.ByteString.Lazy.Char8 (unpack) +import Data.Function ((&)) import Data.List (find, foldl') -import Data.String (fromString) import Data.Text (Text) import Data.Text qualified as T import Data.Text.Encoding (decodeUtf8) @@ -19,8 +18,8 @@ import GHC.Generics (Generic) import Issue.Tag (Tag (..)) import Issue.Tag qualified as I import Issue.Text qualified as I -import Process (quote, sh) -import Text.Printf (printf) +import Process (sh) +import System.Process.Typed (setWorkingDir) import TreeGrepper.Match (Match (..)) import TreeGrepper.Match qualified as G import TreeGrepper.Result (Result (..)) @@ -59,12 +58,13 @@ id issue = issue.tags ++ issue.internalTags ) -fromMatch :: G.Result -> G.Match -> IO (Maybe Issue) -fromMatch result match = do +fromMatch :: FilePath -> G.Result -> G.Match -> IO (Maybe Issue) +fromMatch cwd result match = do rawProvenance <- fmap (T.splitOn "\NUL" . head . T.lines . decodeUtf8 . toStrict) $ sh $ "git show --quiet --format='%H%x00%ai%x00%ae%x00%an'" + & setWorkingDir cwd let provenance = case rawProvenance of firstCommit' : rawDate : authorEmail : authorName : _ -> |