diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-01-01 15:56:24 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-01-01 15:56:24 -0400 |
commit | 02fe8a497434ed6b7cfa12d68779bcaa0d9813c2 (patch) | |
tree | fd884b759a3e22af4b679de2c24d3dfb914058d1 | |
parent | 131e38a3ae3d40fb38738e78df6fed4e4a1e6005 (diff) |
improve data type
-rw-r--r-- | Assistant/Threads/ConfigMonitor.hs | 3 | ||||
-rw-r--r-- | CmdLine/Seek.hs | 2 | ||||
-rw-r--r-- | Database/Keys.hs | 2 | ||||
-rw-r--r-- | Git/LsTree.hs | 4 | ||||
-rw-r--r-- | Git/Repair.hs | 4 |
5 files changed, 8 insertions, 7 deletions
diff --git a/Assistant/Threads/ConfigMonitor.hs b/Assistant/Threads/ConfigMonitor.hs index 7ab55fb82..d63faff5e 100644 --- a/Assistant/Threads/ConfigMonitor.hs +++ b/Assistant/Threads/ConfigMonitor.hs @@ -20,6 +20,7 @@ import Logs.Group import Logs.NumCopies import Remote.List (remoteListRefresh) import qualified Git.LsTree as LsTree +import Git.Types import Git.FilePath import qualified Annex.Branch @@ -51,7 +52,7 @@ configMonitorThread = namedThread "ConfigMonitor" $ loop =<< getConfigs loop new {- Config files, and their checksums. -} -type Configs = S.Set (FilePath, String) +type Configs = S.Set (FilePath, Sha) {- All git-annex's config files, and actions to run when they change. -} configFilesActions :: [(FilePath, Assistant ())] diff --git a/CmdLine/Seek.hs b/CmdLine/Seek.hs index cb7faebac..be2bd22c3 100644 --- a/CmdLine/Seek.hs +++ b/CmdLine/Seek.hs @@ -80,7 +80,7 @@ withFilesInRefs a = mapM_ go (l, cleanup) <- inRepo $ LsTree.lsTree (Git.Ref r) forM_ l $ \i -> do let f = getTopFilePath $ LsTree.file i - v <- catKey (Git.Ref $ LsTree.sha i) + v <- catKey (LsTree.sha i) case v of Nothing -> noop Just k -> whenM (matcher $ MatchingKey k) $ diff --git a/Database/Keys.hs b/Database/Keys.hs index 7a844b5b0..aeb71ecde 100644 --- a/Database/Keys.hs +++ b/Database/Keys.hs @@ -221,7 +221,7 @@ scanAssociatedFiles = whenM (isJust <$> inRepo Git.Branch.current) $ forM_ l $ \i -> when (isregfile i) $ maybe noop (add h i) - =<< catKey (Git.Types.Ref $ Git.LsTree.sha i) + =<< catKey (Git.LsTree.sha i) liftIO $ void cleanup where dropallassociated = queueDb $ diff --git a/Git/LsTree.hs b/Git/LsTree.hs index 13f3e4bcd..b1d9190d0 100644 --- a/Git/LsTree.hs +++ b/Git/LsTree.hs @@ -26,7 +26,7 @@ import System.Posix.Types data TreeItem = TreeItem { mode :: FileMode , typeobj :: String - , sha :: String + , sha :: Ref , file :: TopFilePath } deriving Show @@ -66,7 +66,7 @@ parseLsTree :: String -> TreeItem parseLsTree l = TreeItem { mode = fst $ Prelude.head $ readOct m , typeobj = t - , sha = s + , sha = Ref s , file = asTopFilePath $ Git.Filename.decode f } where diff --git a/Git/Repair.hs b/Git/Repair.hs index b441f1337..fcfc03600 100644 --- a/Git/Repair.hs +++ b/Git/Repair.hs @@ -342,8 +342,8 @@ verifyTree missing treesha r | S.member treesha missing = return False | otherwise = do (ls, cleanup) <- pipeNullSplit (LsTree.lsTreeParams treesha []) r - let objshas = map (extractSha . LsTree.sha . LsTree.parseLsTree) ls - if any isNothing objshas || any (`S.member` missing) (catMaybes objshas) + let objshas = map (LsTree.sha . LsTree.parseLsTree) ls + if any (`S.member` missing) objshas then do void cleanup return False |