File tree Expand file tree Collapse file tree 3 files changed +19
-5
lines changed Expand file tree Collapse file tree 3 files changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ addToStore
7878 . (NamedAlgo a )
7979 => StorePathName -- ^ Name part of the newly created `StorePath`
8080 -> NarSource MonadStore -- ^ provide nar stream
81- -> Bool -- ^ Add target directory recursively
81+ -> Recursive -- ^ Add target directory recursively
8282 -> RepairFlag -- ^ Only used by local store backend
8383 -> MonadStore StorePath
8484addToStore name source recursive repair = do
@@ -88,8 +88,8 @@ addToStore name source recursive repair = do
8888 runOpArgsIO AddToStore $ \ yield -> do
8989 yield $ toStrict $ Data.Binary.Put. runPut $ do
9090 putText $ System.Nix.StorePath. unStorePathName name
91- putBool $ not $ System.Nix.Hash. algoName @ a == " sha256" && recursive
92- putBool recursive
91+ putBool $ not $ System.Nix.Hash. algoName @ a == " sha256" && (unRecursive recursive)
92+ putBool (unRecursive recursive)
9393 putText $ System.Nix.Hash. algoName @ a
9494 source yield
9595 sockGetPath
Original file line number Diff line number Diff line change @@ -16,6 +16,10 @@ module System.Nix.Store.Remote.Types
1616 , doSubstitute
1717 , dontSubstitute
1818 , unSubstituteFlag
19+ , Recursive
20+ , addRecursive
21+ , addNonRecursive
22+ , unRecursive
1923 , Logger (.. )
2024 , Field (.. )
2125 , mapStoreDir
@@ -66,6 +70,16 @@ doSubstitute, dontSubstitute :: SubstituteFlag
6670doSubstitute = SubstituteFlag True
6771dontSubstitute = SubstituteFlag False
6872
73+ -- | Recursive, used by @addToStore@
74+ newtype Recursive = Recursive { unRecursive :: Bool }
75+ deriving (Eq , Ord , Show )
76+
77+ addRecursive , addNonRecursive :: Recursive
78+ -- | Add target directory recursively
79+ addRecursive = Recursive True
80+ -- | Add target directory non-recursively
81+ addNonRecursive = Recursive False
82+
6983type MonadStore a
7084 = ExceptT
7185 String
Original file line number Diff line number Diff line change @@ -161,7 +161,7 @@ withPath action = do
161161dummy :: MonadStore StorePath
162162dummy = do
163163 let name = Data.Either. fromRight (error " impossible" ) $ makeStorePathName " dummy"
164- addToStore @ SHA256 name (dumpPath " dummy" ) False dontRepair
164+ addToStore @ SHA256 name (dumpPath " dummy" ) addNonRecursive dontRepair
165165
166166invalidPath :: StorePath
167167invalidPath =
@@ -252,7 +252,7 @@ spec_protocol = Hspec.around withNixDaemon $
252252 itRights " adds file to store" $ do
253253 fp <- liftIO $ writeSystemTempFile " addition" " lal"
254254 let name = Data.Either. fromRight (error " impossible" ) $ makeStorePathName " tmp-addition"
255- res <- addToStore @ SHA256 name (dumpPath fp) False dontRepair
255+ res <- addToStore @ SHA256 name (dumpPath fp) addNonRecursive dontRepair
256256 liftIO $ print res
257257
258258 context " with dummy" $ do
You can’t perform that action at this time.
0 commit comments