From 77fb8f419d09fa3a8211f725aead12881a1cde57 Mon Sep 17 00:00:00 2001 From: voidlizard Date: Fri, 6 Dec 2024 13:53:40 +0300 Subject: [PATCH] wip27 --- hbs2-git3/app/Main.hs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/hbs2-git3/app/Main.hs b/hbs2-git3/app/Main.hs index beff3540..48eed454 100644 --- a/hbs2-git3/app/Main.hs +++ b/hbs2-git3/app/Main.hs @@ -1213,14 +1213,18 @@ theDict = do let (prefix,name) = L.splitAt 2 gitHash let path = joinPath [d, "objects", prefix, name] - touch path + here <- doesPathExist path - liftIO $ print $ pretty t <+> pretty s <+> pretty h <+> pretty path + unless here do - let params = Zlib.defaultCompressParams { Zlib.compressMethod = Zlib.deflateMethod } - UIO.withBinaryFileAtomic path WriteMode $ \fh -> do - let contents = Zlib.compressWith params (signature <> body) - LBS.hPutStr fh contents + touch path + + liftIO $ print $ pretty t <+> pretty s <+> pretty h <+> pretty path + + let params = Zlib.defaultCompressParams { Zlib.compressMethod = Zlib.deflateMethod } + UIO.withBinaryFileAtomic path WriteMode $ \fh -> do + let contents = Zlib.compressWith params (signature <> body) + LBS.hPutStr fh contents pure True