diff options
Diffstat (limited to 'app/Main.hs')
-rw-r--r-- | app/Main.hs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/app/Main.hs b/app/Main.hs index bb8947d..47f0280 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -12,8 +12,11 @@ import Data.ByteString.Lazy.Char8 qualified as LB import Data.List (foldl', isSuffixOf) import Data.Maybe (fromMaybe, mapMaybe) import Data.Set qualified as S +import Data.String (IsString (fromString)) +import Data.Tagged (Tagged (Tagged)) import Data.Text qualified as T import Debug.Trace (trace) +import Git import Store qualified as S import System.Directory (setCurrentDirectory) import System.FilePath ((</>)) @@ -143,7 +146,9 @@ query (Select fs c js ws) = do where ls c = filter (not . (isSuffixOf "/")) - <$> S.withStore "." "HEAD" (S.listDirectory c) + <$> S.withStore "." do + Just cid <- fmap Tagged <$> resolveReference "HEAD" + S.listDirectory cid c combine :: [Record J.Value] -> [Join [Record J.Value]] -> [[Record J.Value]] combine vs js = combine' (map (: []) vs) js @@ -192,9 +197,9 @@ data DecodeException = DecodeException instance Exception DecodeException decodeFile :: J.FromJSON a => FilePath -> IO a -decodeFile fp = - S.withStore "." "HEAD" $ - fromMaybe (throw DecodeException) . J.decode <$> S.readFile fp +decodeFile fp = S.withStore "." do + Just cid <- fmap Tagged <$> resolveReference "HEAD" + fromMaybe (throw DecodeException) . J.decode <$> S.readFile cid fp select :: FieldSelector -> [Record J.Value] -> J.Value select All vs = |