Skip to content

Commit 457683d

Browse files
committed
Inline makeTextPath
1 parent 59f1e00 commit 457683d

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

hnix-store-readonly/src/System/Nix/Store/ReadOnly.hs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -81,19 +81,6 @@ makeType storeDir ty refs =
8181
$ references_others refs
8282
self = ["self" | references_self refs]
8383

84-
makeTextPath
85-
:: StoreDir
86-
-> Digest SHA256
87-
-> HashSet StorePath
88-
-> StorePathName
89-
-> StorePath
90-
makeTextPath storeDir h refs nm = makeStorePath storeDir ty (HashAlgo_SHA256 :=> h) nm
91-
where
92-
ty = makeType storeDir "text" $ References
93-
{ references_others = refs
94-
, references_self = False
95-
}
96-
9784
makeFixedOutputPath
9885
:: StoreDir
9986
-> ContentAddressMethod
@@ -105,7 +92,10 @@ makeFixedOutputPath storeDir method digest@(hashAlgo :=> h) refs =
10592
case method of
10693
ContentAddressMethod_Text ->
10794
case hashAlgo of
108-
HashAlgo_SHA256 -> makeTextPath storeDir h $ references_others refs
95+
HashAlgo_SHA256
96+
| references_self refs == False -> makeStorePath storeDir ty digest
97+
where
98+
ty = makeType storeDir "text" refs
10999
_ -> error "unsupported" -- TODO do better; maybe we'll just remove this restriction too?
110100
_ ->
111101
if method == ContentAddressMethod_NixArchive

0 commit comments

Comments
 (0)