hlint
This commit is contained in:
parent
dd667844b6
commit
b61c6bc2ff
18 changed files with 50 additions and 52 deletions
30
Assistant.hs
30
Assistant.hs
|
@ -147,7 +147,7 @@ startDaemon assistant foreground startdelay cannotrun listenhost startbrowser =
|
||||||
let threads = if isJust cannotrun
|
let threads = if isJust cannotrun
|
||||||
then webappthread
|
then webappthread
|
||||||
else webappthread ++
|
else webappthread ++
|
||||||
[ watch $ commitThread
|
[ watch commitThread
|
||||||
#ifdef WITH_WEBAPP
|
#ifdef WITH_WEBAPP
|
||||||
#ifdef WITH_PAIRING
|
#ifdef WITH_PAIRING
|
||||||
, assist $ pairListenerThread urlrenderer
|
, assist $ pairListenerThread urlrenderer
|
||||||
|
@ -158,29 +158,29 @@ startDaemon assistant foreground startdelay cannotrun listenhost startbrowser =
|
||||||
, assist $ xmppReceivePackThread urlrenderer
|
, assist $ xmppReceivePackThread urlrenderer
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
, assist $ pushThread
|
, assist pushThread
|
||||||
, assist $ pushRetryThread
|
, assist pushRetryThread
|
||||||
, assist $ mergeThread
|
, assist mergeThread
|
||||||
, assist $ transferWatcherThread
|
, assist transferWatcherThread
|
||||||
, assist $ transferPollerThread
|
, assist transferPollerThread
|
||||||
, assist $ transfererThread
|
, assist transfererThread
|
||||||
, assist $ remoteControlThread
|
, assist remoteControlThread
|
||||||
, assist $ daemonStatusThread
|
, assist daemonStatusThread
|
||||||
, assist $ sanityCheckerDailyThread urlrenderer
|
, assist $ sanityCheckerDailyThread urlrenderer
|
||||||
, assist $ sanityCheckerHourlyThread
|
, assist sanityCheckerHourlyThread
|
||||||
, assist $ problemFixerThread urlrenderer
|
, assist $ problemFixerThread urlrenderer
|
||||||
#ifdef WITH_CLIBS
|
#ifdef WITH_CLIBS
|
||||||
, assist $ mountWatcherThread urlrenderer
|
, assist $ mountWatcherThread urlrenderer
|
||||||
#endif
|
#endif
|
||||||
, assist $ netWatcherThread
|
, assist netWatcherThread
|
||||||
, assist $ upgraderThread urlrenderer
|
, assist $ upgraderThread urlrenderer
|
||||||
, assist $ upgradeWatcherThread urlrenderer
|
, assist $ upgradeWatcherThread urlrenderer
|
||||||
, assist $ netWatcherFallbackThread
|
, assist netWatcherFallbackThread
|
||||||
, assist $ transferScannerThread urlrenderer
|
, assist $ transferScannerThread urlrenderer
|
||||||
, assist $ cronnerThread urlrenderer
|
, assist $ cronnerThread urlrenderer
|
||||||
, assist $ configMonitorThread
|
, assist configMonitorThread
|
||||||
, assist $ glacierThread
|
, assist glacierThread
|
||||||
, watch $ watchThread
|
, watch watchThread
|
||||||
-- must come last so that all threads that wait
|
-- must come last so that all threads that wait
|
||||||
-- on it have already started waiting
|
-- on it have already started waiting
|
||||||
, watch $ sanityCheckerStartupThread startdelay
|
, watch $ sanityCheckerStartupThread startdelay
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
-}
|
-}
|
||||||
|
|
||||||
{-# LANGUAGE CPP #-}
|
{-# LANGUAGE CPP #-}
|
||||||
{-# LANGUAGE BangPatterns #-}
|
|
||||||
|
|
||||||
module CmdLine (
|
module CmdLine (
|
||||||
dispatch,
|
dispatch,
|
||||||
|
|
|
@ -177,14 +177,14 @@ ingest (Just source) = withTSDelta $ \delta -> do
|
||||||
(undo (keyFilename source) key)
|
(undo (keyFilename source) key)
|
||||||
maybe noop (genMetaData key (keyFilename source)) ms
|
maybe noop (genMetaData key (keyFilename source)) ms
|
||||||
liftIO $ nukeFile $ keyFilename source
|
liftIO $ nukeFile $ keyFilename source
|
||||||
return $ (Just key, mcache)
|
return (Just key, mcache)
|
||||||
goindirect _ _ _ = failure "failed to generate a key"
|
goindirect _ _ _ = failure "failed to generate a key"
|
||||||
|
|
||||||
godirect (Just (key, _)) (Just cache) ms = do
|
godirect (Just (key, _)) (Just cache) ms = do
|
||||||
addInodeCache key cache
|
addInodeCache key cache
|
||||||
maybe noop (genMetaData key (keyFilename source)) ms
|
maybe noop (genMetaData key (keyFilename source)) ms
|
||||||
finishIngestDirect key source
|
finishIngestDirect key source
|
||||||
return $ (Just key, Just cache)
|
return (Just key, Just cache)
|
||||||
godirect _ _ _ = failure "failed to generate a key"
|
godirect _ _ _ = failure "failed to generate a key"
|
||||||
|
|
||||||
failure msg = do
|
failure msg = do
|
||||||
|
|
|
@ -30,7 +30,7 @@ start gcryptid = next $ next $ do
|
||||||
g <- gitRepo
|
g <- gitRepo
|
||||||
gu <- Remote.GCrypt.getGCryptUUID True g
|
gu <- Remote.GCrypt.getGCryptUUID True g
|
||||||
let newgu = genUUIDInNameSpace gCryptNameSpace gcryptid
|
let newgu = genUUIDInNameSpace gCryptNameSpace gcryptid
|
||||||
if gu == Nothing || gu == Just newgu
|
if isNothing gu || gu == Just newgu
|
||||||
then if Git.repoIsLocalBare g
|
then if Git.repoIsLocalBare g
|
||||||
then do
|
then do
|
||||||
void $ Remote.GCrypt.setupRepo gcryptid g
|
void $ Remote.GCrypt.setupRepo gcryptid g
|
||||||
|
|
|
@ -96,7 +96,7 @@ start mode (srcfile, destfile) =
|
||||||
handleexisting Nothing = noop
|
handleexisting Nothing = noop
|
||||||
handleexisting (Just s)
|
handleexisting (Just s)
|
||||||
| isDirectory s = notoverwriting "(is a directory)"
|
| isDirectory s = notoverwriting "(is a directory)"
|
||||||
| otherwise = ifM (Annex.getState Annex.force) $
|
| otherwise = ifM (Annex.getState Annex.force)
|
||||||
( liftIO $ nukeFile destfile
|
( liftIO $ nukeFile destfile
|
||||||
, notoverwriting "(use --force to override)"
|
, notoverwriting "(use --force to override)"
|
||||||
)
|
)
|
||||||
|
|
|
@ -264,7 +264,7 @@ backend_usage = stat "backend usage" $ nojson $
|
||||||
where
|
where
|
||||||
calc x y = multiLine $
|
calc x y = multiLine $
|
||||||
map (\(n, b) -> b ++ ": " ++ show n) $
|
map (\(n, b) -> b ++ ": " ++ show n) $
|
||||||
reverse $ sort $ map swap $ M.toList $
|
sortBy (flip compare) $ map swap $ M.toList $
|
||||||
M.unionWith (+) x y
|
M.unionWith (+) x y
|
||||||
|
|
||||||
numcopies_stats :: Stat
|
numcopies_stats :: Stat
|
||||||
|
@ -273,7 +273,7 @@ numcopies_stats = stat "numcopies stats" $ nojson $
|
||||||
where
|
where
|
||||||
calc = multiLine
|
calc = multiLine
|
||||||
. map (\(variance, count) -> show variance ++ ": " ++ show count)
|
. map (\(variance, count) -> show variance ++ ": " ++ show count)
|
||||||
. reverse . sortBy (comparing snd) . M.toList
|
. sortBy (flip (comparing snd)) . M.toList
|
||||||
|
|
||||||
cachedPresentData :: StatState KeyData
|
cachedPresentData :: StatState KeyData
|
||||||
cachedPresentData = do
|
cachedPresentData = do
|
||||||
|
|
|
@ -63,7 +63,7 @@ findExisting name = do
|
||||||
return $ headMaybe matches
|
return $ headMaybe matches
|
||||||
|
|
||||||
newConfig :: String -> R.RemoteConfig
|
newConfig :: String -> R.RemoteConfig
|
||||||
newConfig name = M.singleton nameKey name
|
newConfig = M.singleton nameKey
|
||||||
|
|
||||||
findByName :: String -> M.Map UUID R.RemoteConfig -> [(UUID, R.RemoteConfig)]
|
findByName :: String -> M.Map UUID R.RemoteConfig -> [(UUID, R.RemoteConfig)]
|
||||||
findByName n = filter (matching . snd) . M.toList
|
findByName n = filter (matching . snd) . M.toList
|
||||||
|
|
|
@ -32,7 +32,7 @@ seek ps = do
|
||||||
ps
|
ps
|
||||||
|
|
||||||
start :: Maybe Remote -> Maybe Remote -> FilePath -> Key -> CommandStart
|
start :: Maybe Remote -> Maybe Remote -> FilePath -> Key -> CommandStart
|
||||||
start to from file key = startKey to from (Just file) key
|
start to from file = startKey to from (Just file)
|
||||||
|
|
||||||
startKey :: Maybe Remote -> Maybe Remote -> Maybe FilePath -> Key -> CommandStart
|
startKey :: Maybe Remote -> Maybe Remote -> Maybe FilePath -> Key -> CommandStart
|
||||||
startKey to from afile key = do
|
startKey to from afile key = do
|
||||||
|
|
|
@ -34,7 +34,7 @@ seek ps = do
|
||||||
ps
|
ps
|
||||||
|
|
||||||
start :: Maybe Remote -> Maybe Remote -> Bool -> FilePath -> Key -> CommandStart
|
start :: Maybe Remote -> Maybe Remote -> Bool -> FilePath -> Key -> CommandStart
|
||||||
start to from move file key = start' to from move (Just file) key
|
start to from move = start' to from move . Just
|
||||||
|
|
||||||
startKey :: Maybe Remote -> Maybe Remote -> Bool -> Key -> CommandStart
|
startKey :: Maybe Remote -> Maybe Remote -> Bool -> Key -> CommandStart
|
||||||
startKey to from move = start' to from move Nothing
|
startKey to from move = start' to from move Nothing
|
||||||
|
@ -91,7 +91,7 @@ expectedPresent dest key = do
|
||||||
return $ dest `elem` remotes
|
return $ dest `elem` remotes
|
||||||
|
|
||||||
toPerform :: Remote -> Bool -> Key -> AssociatedFile -> Bool -> Either String Bool -> CommandPerform
|
toPerform :: Remote -> Bool -> Key -> AssociatedFile -> Bool -> Either String Bool -> CommandPerform
|
||||||
toPerform dest move key afile fastcheck isthere = do
|
toPerform dest move key afile fastcheck isthere =
|
||||||
case isthere of
|
case isthere of
|
||||||
Left err -> do
|
Left err -> do
|
||||||
showNote err
|
showNote err
|
||||||
|
|
|
@ -51,7 +51,7 @@ start = do
|
||||||
|
|
||||||
-- No messages need to be received from the caller,
|
-- No messages need to be received from the caller,
|
||||||
-- but when it closes the connection, notice and terminate.
|
-- but when it closes the connection, notice and terminate.
|
||||||
let receiver = forever $ void $ getLine
|
let receiver = forever $ void getLine
|
||||||
void $ liftIO $ concurrently sender receiver
|
void $ liftIO $ concurrently sender receiver
|
||||||
stop
|
stop
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,7 @@ seek = withWords start
|
||||||
|
|
||||||
start :: [String] -> CommandStart
|
start :: [String] -> CommandStart
|
||||||
start [] = startGet
|
start [] = startGet
|
||||||
start [s] = do
|
start [s] = case readish s of
|
||||||
case readish s of
|
|
||||||
Nothing -> error $ "Bad number: " ++ s
|
Nothing -> error $ "Bad number: " ++ s
|
||||||
Just n
|
Just n
|
||||||
| n > 0 -> startSet n
|
| n > 0 -> startSet n
|
||||||
|
@ -39,9 +38,9 @@ startGet = next $ next $ do
|
||||||
Annex.setOutput QuietOutput
|
Annex.setOutput QuietOutput
|
||||||
v <- getGlobalNumCopies
|
v <- getGlobalNumCopies
|
||||||
case v of
|
case v of
|
||||||
Just n -> liftIO $ putStrLn $ show $ fromNumCopies n
|
Just n -> liftIO $ print $ fromNumCopies n
|
||||||
Nothing -> do
|
Nothing -> do
|
||||||
liftIO $ putStrLn $ "global numcopies is not set"
|
liftIO $ putStrLn "global numcopies is not set"
|
||||||
old <- deprecatedNumCopies
|
old <- deprecatedNumCopies
|
||||||
case old of
|
case old of
|
||||||
Nothing -> liftIO $ putStrLn "(default is 1)"
|
Nothing -> liftIO $ putStrLn "(default is 1)"
|
||||||
|
|
|
@ -59,7 +59,7 @@ startIndirect f = next $ do
|
||||||
next $ return True
|
next $ return True
|
||||||
|
|
||||||
startDirect :: [String] -> CommandStart
|
startDirect :: [String] -> CommandStart
|
||||||
startDirect _ = next $ next $ preCommitDirect
|
startDirect _ = next $ next preCommitDirect
|
||||||
|
|
||||||
addViewMetaData :: View -> ViewedFile -> Key -> CommandStart
|
addViewMetaData :: View -> ViewedFile -> Key -> CommandStart
|
||||||
addViewMetaData v f k = do
|
addViewMetaData v f k = do
|
||||||
|
|
|
@ -68,7 +68,7 @@ repairAnnexBranch modifiedbranches
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
okindex = Annex.Branch.withIndex $ inRepo $ Git.Repair.checkIndex
|
okindex = Annex.Branch.withIndex $ inRepo Git.Repair.checkIndex
|
||||||
commitindex = do
|
commitindex = do
|
||||||
Annex.Branch.forceCommit "committing index after git repository repair"
|
Annex.Branch.forceCommit "committing index after git repository repair"
|
||||||
liftIO $ putStrLn "Successfully recovered the git-annex branch using .git/annex/index"
|
liftIO $ putStrLn "Successfully recovered the git-annex branch using .git/annex/index"
|
||||||
|
|
|
@ -19,7 +19,7 @@ def = [command "resolvemerge" paramNothing seek SectionPlumbing
|
||||||
"resolve merge conflicts"]
|
"resolve merge conflicts"]
|
||||||
|
|
||||||
seek :: CommandSeek
|
seek :: CommandSeek
|
||||||
seek ps = withNothing start ps
|
seek = withNothing start
|
||||||
|
|
||||||
start :: CommandStart
|
start :: CommandStart
|
||||||
start = do
|
start = do
|
||||||
|
|
2
Limit.hs
2
Limit.hs
|
@ -82,7 +82,7 @@ addExclude = addLimit . limitExclude
|
||||||
limitExclude :: MkLimit Annex
|
limitExclude :: MkLimit Annex
|
||||||
limitExclude glob = Right $ const $ return . not . matchGlobFile glob
|
limitExclude glob = Right $ const $ return . not . matchGlobFile glob
|
||||||
|
|
||||||
matchGlobFile :: String -> (MatchInfo -> Bool)
|
matchGlobFile :: String -> MatchInfo -> Bool
|
||||||
matchGlobFile glob = go
|
matchGlobFile glob = go
|
||||||
where
|
where
|
||||||
cglob = compileGlob glob CaseSensative -- memoized
|
cglob = compileGlob glob CaseSensative -- memoized
|
||||||
|
|
2
Logs.hs
2
Logs.hs
|
@ -173,7 +173,7 @@ prop_logs_sane dummykey = and
|
||||||
, expect gotNewUUIDBasedLog (getLogVariety $ remoteStateLogFile dummykey)
|
, expect gotNewUUIDBasedLog (getLogVariety $ remoteStateLogFile dummykey)
|
||||||
, expect gotChunkLog (getLogVariety $ chunkLogFile dummykey)
|
, expect gotChunkLog (getLogVariety $ chunkLogFile dummykey)
|
||||||
, expect gotOtherLog (getLogVariety $ metaDataLogFile dummykey)
|
, expect gotOtherLog (getLogVariety $ metaDataLogFile dummykey)
|
||||||
, expect gotOtherLog (getLogVariety $ numcopiesLog)
|
, expect gotOtherLog (getLogVariety numcopiesLog)
|
||||||
]
|
]
|
||||||
where
|
where
|
||||||
expect = maybe False
|
expect = maybe False
|
||||||
|
|
|
@ -103,12 +103,12 @@ byNameWithUUID = checkuuid <=< byName
|
||||||
where
|
where
|
||||||
checkuuid Nothing = return Nothing
|
checkuuid Nothing = return Nothing
|
||||||
checkuuid (Just r)
|
checkuuid (Just r)
|
||||||
| uuid r == NoUUID =
|
| uuid r == NoUUID = error $
|
||||||
if remoteAnnexIgnore (gitconfig r)
|
if remoteAnnexIgnore (gitconfig r)
|
||||||
then error $ noRemoteUUIDMsg r ++
|
then noRemoteUUIDMsg r ++
|
||||||
" (" ++ show (remoteConfig (repo r) "ignore") ++
|
" (" ++ show (remoteConfig (repo r) "ignore") ++
|
||||||
" is set)"
|
" is set)"
|
||||||
else error $ noRemoteUUIDMsg r
|
else noRemoteUUIDMsg r
|
||||||
| otherwise = return $ Just r
|
| otherwise = return $ Just r
|
||||||
|
|
||||||
byName' :: RemoteName -> Annex (Either String Remote)
|
byName' :: RemoteName -> Annex (Either String Remote)
|
||||||
|
|
10
Test.hs
10
Test.hs
|
@ -957,7 +957,7 @@ test_nonannexed_file_conflict_resolution testenv = do
|
||||||
check False True
|
check False True
|
||||||
where
|
where
|
||||||
check inr1 switchdirect = withtmpclonerepo testenv False $ \r1 ->
|
check inr1 switchdirect = withtmpclonerepo testenv False $ \r1 ->
|
||||||
withtmpclonerepo testenv False $ \r2 -> do
|
withtmpclonerepo testenv False $ \r2 ->
|
||||||
whenM (isInDirect r1 <&&> isInDirect r2) $ do
|
whenM (isInDirect r1 <&&> isInDirect r2) $ do
|
||||||
indir testenv r1 $ do
|
indir testenv r1 $ do
|
||||||
disconnectOrigin
|
disconnectOrigin
|
||||||
|
@ -1007,7 +1007,7 @@ test_nonannexed_symlink_conflict_resolution testenv = do
|
||||||
check False True
|
check False True
|
||||||
where
|
where
|
||||||
check inr1 switchdirect = withtmpclonerepo testenv False $ \r1 ->
|
check inr1 switchdirect = withtmpclonerepo testenv False $ \r1 ->
|
||||||
withtmpclonerepo testenv False $ \r2 -> do
|
withtmpclonerepo testenv False $ \r2 ->
|
||||||
whenM (checkRepo (Types.coreSymlinks <$> Annex.getGitConfig) r1
|
whenM (checkRepo (Types.coreSymlinks <$> Annex.getGitConfig) r1
|
||||||
<&&> isInDirect r1 <&&> isInDirect r2) $ do
|
<&&> isInDirect r1 <&&> isInDirect r2) $ do
|
||||||
indir testenv r1 $ do
|
indir testenv r1 $ do
|
||||||
|
@ -1094,9 +1094,9 @@ test_uncommitted_conflict_resolution testenv = do
|
||||||
- lost track of whether a file was a symlink.
|
- lost track of whether a file was a symlink.
|
||||||
-}
|
-}
|
||||||
test_conflict_resolution_symlink_bit :: TestEnv -> Assertion
|
test_conflict_resolution_symlink_bit :: TestEnv -> Assertion
|
||||||
test_conflict_resolution_symlink_bit testenv = do
|
test_conflict_resolution_symlink_bit testenv =
|
||||||
withtmpclonerepo testenv False $ \r1 ->
|
withtmpclonerepo testenv False $ \r1 ->
|
||||||
withtmpclonerepo testenv False $ \r2 -> do
|
withtmpclonerepo testenv False $ \r2 ->
|
||||||
withtmpclonerepo testenv False $ \r3 -> do
|
withtmpclonerepo testenv False $ \r3 -> do
|
||||||
indir testenv r1 $ do
|
indir testenv r1 $ do
|
||||||
writeFile conflictor "conflictor"
|
writeFile conflictor "conflictor"
|
||||||
|
@ -1152,7 +1152,7 @@ test_uninit_inbranch testenv = intmpclonerepoInDirect testenv $ do
|
||||||
not <$> git_annex testenv "uninit" [] @? "uninit failed to fail when git-annex branch was checked out"
|
not <$> git_annex testenv "uninit" [] @? "uninit failed to fail when git-annex branch was checked out"
|
||||||
|
|
||||||
test_upgrade :: TestEnv -> Assertion
|
test_upgrade :: TestEnv -> Assertion
|
||||||
test_upgrade testenv = intmpclonerepo testenv $ do
|
test_upgrade testenv = intmpclonerepo testenv $
|
||||||
git_annex testenv "upgrade" [] @? "upgrade from same version failed"
|
git_annex testenv "upgrade" [] @? "upgrade from same version failed"
|
||||||
|
|
||||||
test_whereis :: TestEnv -> Assertion
|
test_whereis :: TestEnv -> Assertion
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue