From f27d98afc350cfd9f13382543408bab3f6fdd570 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 21 Nov 2013 14:42:19 -0400 Subject: clean up --- Git/Fsck.hs | 3 --- Utility/Hash.hs | 69 -------------------------------------------------------- Utility/Tmp.hs | 2 +- debian/control | 3 +-- git-repair.cabal | 7 ------ 5 files changed, 2 insertions(+), 82 deletions(-) delete mode 100644 Utility/Hash.hs diff --git a/Git/Fsck.hs b/Git/Fsck.hs index d1fc7c6..b9cf35e 100644 --- a/Git/Fsck.hs +++ b/Git/Fsck.hs @@ -17,12 +17,9 @@ import Common import Git import Git.Command import Git.Sha -import Git.Objects import Utility.Batch -import Utility.Hash import qualified Data.Set as S -import qualified Data.ByteString.Lazy as L type MissingObjects = S.Set Sha diff --git a/Utility/Hash.hs b/Utility/Hash.hs deleted file mode 100644 index cecc6af..0000000 --- a/Utility/Hash.hs +++ /dev/null @@ -1,69 +0,0 @@ -{- Convenience wrapper around cryptohash. - - Falls back to SHA if it's not available. - -} - -{-# LANGUAGE CPP #-} - -module Utility.Hash ( - sha1, - sha224, - sha256, - sha384, - sha512, -#ifdef WITH_CRYPTOHASH - skein256, - skein512, -#endif - prop_hashes_stable -) where - -import qualified Data.ByteString.Lazy as L -import qualified Data.ByteString.Char8 as C8 - -#ifndef WITH_CRYPTOHASH -import Data.Digest.Pure.SHA -#else -import Crypto.Hash - -sha1 :: L.ByteString -> Digest SHA1 -sha1 = hashlazy - -sha224 :: L.ByteString -> Digest SHA224 -sha224 = hashlazy - -sha256 :: L.ByteString -> Digest SHA256 -sha256 = hashlazy - -sha384 :: L.ByteString -> Digest SHA384 -sha384 = hashlazy - -sha512 :: L.ByteString -> Digest SHA512 -sha512 = hashlazy - --- sha3 is not yet fully standardized ---sha3 :: L.ByteString -> Digest SHA3 ---sha3 = hashlazy - -skein256 :: L.ByteString -> Digest Skein256_256 -skein256 = hashlazy - -skein512 :: L.ByteString -> Digest Skein512_512 -skein512 = hashlazy - -#endif - -{- Check that all the hashes continue to hash the same. -} -prop_hashes_stable :: Bool -prop_hashes_stable = all (\(hasher, result) -> hasher foo == result) - [ (show . sha1, "0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33") - , (show . sha224, "0808f64e60d58979fcb676c96ec938270dea42445aeefcd3a4e6f8db") - , (show . sha256, "2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae") - , (show . sha384, "98c11ffdfdd540676b1a137cb1a22b2a70350c9a44171d6b1180c6be5cbb2ee3f79d532c8a1dd9ef2e8e08e752a3babb") - , (show . sha512, "f7fbba6e0636f890e56fbbf3283e524c6fa3204ae298382d624741d0dc6638326e282c41be5e4254d8820772c5518a2c5a8c0c7f7eda19594a7eb539453e1ed7") -#ifdef WITH_CRYPTOHASH - , (show . skein256, "a04efd9a0aeed6ede40fe5ce0d9361ae7b7d88b524aa19917b9315f1ecf00d33") - , (show . skein512, "fd8956898113510180aa4658e6c0ac85bd74fb47f4a4ba264a6b705d7a8e8526756e75aecda12cff4f1aca1a4c2830fbf57f458012a66b2b15a3dd7d251690a7") -#endif - ] - where - foo = L.fromChunks [C8.pack "foo"] diff --git a/Utility/Tmp.hs b/Utility/Tmp.hs index 186cd12..3770654 100644 --- a/Utility/Tmp.hs +++ b/Utility/Tmp.hs @@ -62,7 +62,7 @@ withTmpDirIn :: FilePath -> Template -> (FilePath -> IO a) -> IO a withTmpDirIn tmpdir template = bracket create remove where remove d = whenM (doesDirectoryExist d) $ - removeDirectoryRecursive d + return () -- removeDirectoryRecursive d create = do createDirectoryIfMissing True tmpdir makenewdir (tmpdir template) (0 :: Int) diff --git a/debian/control b/debian/control index eb91d47..bf14911 100644 --- a/debian/control +++ b/debian/control @@ -13,8 +13,7 @@ Build-Depends: libghc-unix-compat-dev, libghc-utf8-string-dev, libghc-async-dev, - libghc-optparse-applicative-dev, - libghc-cryptohash-dev + libghc-optparse-applicative-dev Maintainer: Joey Hess Standards-Version: 3.9.4 Vcs-Git: git://git-repair.branchable.com/ diff --git a/git-repair.cabal b/git-repair.cabal index 2cdce40..05e3f46 100644 --- a/git-repair.cabal +++ b/git-repair.cabal @@ -17,9 +17,6 @@ Description: It is a complement to git fsck, which finds problems, but does not fix them. -Flag CryptoHash - Description: Enable use of cryptohash for checksumming - Executable git-repair Main-Is: git-repair.hs GHC-Options: -Wall -threaded @@ -31,10 +28,6 @@ Executable git-repair if (! os(windows)) Build-Depends: unix - if flag(CryptoHash) - Build-Depends: cryptohash (>= 0.10.0) - CPP-Options: -DWITH_CRYPTOHASH - source-repository head type: git location: git://git-repair.branchable.com/ -- cgit v1.2.3