mirror of https://github.com/voidlizard/hbs2
wip
This commit is contained in:
parent
103ec0745b
commit
ff620a8e70
|
@ -375,12 +375,21 @@ runTop forms = do
|
||||||
seen <- maybe1 fn (pure False) selectIsAlreadyScanned
|
seen <- maybe1 fn (pure False) selectIsAlreadyScanned
|
||||||
pure (not seen)
|
pure (not seen)
|
||||||
|
|
||||||
let files = mapMaybe (fixmeGet "file") fxs
|
hashes <- catMaybes <$> flip runContT pure do
|
||||||
& HS.fromList
|
p <- ContT $ bracket startGitHash stopProcess
|
||||||
& HS.toList
|
let files = mapMaybe (fixmeGet "file") fxs
|
||||||
& fmap (Text.unpack . coerce)
|
& HS.fromList
|
||||||
|
& HS.toList
|
||||||
|
& fmap (Text.unpack . coerce)
|
||||||
|
for files $ \f -> do
|
||||||
|
mbHash <- lift $ gitHashPathStdin p f
|
||||||
|
case mbHash of
|
||||||
|
Just ha ->
|
||||||
|
pure $ Just (f, ha)
|
||||||
|
Nothing ->
|
||||||
|
pure Nothing
|
||||||
|
|
||||||
blobs <- listBlobs mzero <&> HM.fromList
|
let blobs = HM.fromList hashes
|
||||||
|
|
||||||
withState $ transactional do
|
withState $ transactional do
|
||||||
for_ fxs $ \fme -> do
|
for_ fxs $ \fme -> do
|
||||||
|
|
|
@ -359,11 +359,28 @@ gitCatBlob h = do
|
||||||
(_,s,_) <- readProcess $ shell [qc|git {gd} cat-file blob {pretty h}|]
|
(_,s,_) <- readProcess $ shell [qc|git {gd} cat-file blob {pretty h}|]
|
||||||
pure s
|
pure s
|
||||||
|
|
||||||
|
|
||||||
|
startGitHash :: (FixmePerks m, MonadReader FixmeEnv m) => m (Process Handle Handle ())
|
||||||
|
startGitHash = do
|
||||||
|
gd <- fixmeGetGitDirCLIOpt
|
||||||
|
let cmd = [qc|git {gd} hash-object --stdin-paths|]
|
||||||
|
debug $ pretty cmd
|
||||||
|
let config = setStdin createPipe $ setStdout createPipe $ setStderr closed $ shell cmd
|
||||||
|
startProcess config
|
||||||
|
|
||||||
|
gitHashPathStdin :: FixmePerks m => (Process Handle Handle e) -> FilePath -> FixmeM m (Maybe GitHash)
|
||||||
|
gitHashPathStdin prc file = do
|
||||||
|
let ssin = getStdin prc
|
||||||
|
let sout = getStdout prc
|
||||||
|
liftIO $ IO.hPutStrLn ssin file >> IO.hFlush ssin
|
||||||
|
liftIO (IO.hGetLine sout) <&> fromStringMay @GitHash
|
||||||
|
|
||||||
startGitCatFile :: (FixmePerks m, MonadReader FixmeEnv m) => m (Process Handle Handle ())
|
startGitCatFile :: (FixmePerks m, MonadReader FixmeEnv m) => m (Process Handle Handle ())
|
||||||
startGitCatFile = do
|
startGitCatFile = do
|
||||||
gd <- fixmeGetGitDirCLIOpt
|
gd <- fixmeGetGitDirCLIOpt
|
||||||
let cmd = [qc|git {gd} cat-file --batch|]
|
let cmd = [qc|git {gd} cat-file --batch|]
|
||||||
debug $ pretty cmd
|
debug $ pretty cmd
|
||||||
let config = setStdin createPipe $ setStdout createPipe $ setStderr closed $ shell cmd
|
let config = setStdin createPipe $ setStdout createPipe $ setStderr closed $ shell cmd
|
||||||
|
-- ssin <- getStdin config
|
||||||
startProcess config
|
startProcess config
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue