relFile does not have to be relative; rename to currFile
This commit is contained in:
parent
dfab5e6ff4
commit
b94eb9b22c
4 changed files with 8 additions and 6 deletions
|
@ -42,7 +42,7 @@ fileMatchInfo file = do
|
||||||
matchfile <- getTopFilePath <$> inRepo (toTopFilePath file)
|
matchfile <- getTopFilePath <$> inRepo (toTopFilePath file)
|
||||||
return $ MatchingFile FileInfo
|
return $ MatchingFile FileInfo
|
||||||
{ matchFile = matchfile
|
{ matchFile = matchfile
|
||||||
, relFile = file
|
, currFile = file
|
||||||
}
|
}
|
||||||
|
|
||||||
matchAll :: FileMatcher Annex
|
matchAll :: FileMatcher Annex
|
||||||
|
|
|
@ -77,7 +77,7 @@ withPathContents a params = do
|
||||||
, return [(p, takeFileName p)]
|
, return [(p, takeFileName p)]
|
||||||
)
|
)
|
||||||
checkmatch matcher (f, relf) = matcher $ MatchingFile $ FileInfo
|
checkmatch matcher (f, relf) = matcher $ MatchingFile $ FileInfo
|
||||||
{ relFile = f
|
{ currFile = f
|
||||||
, matchFile = relf
|
, matchFile = relf
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
4
Limit.hs
4
Limit.hs
|
@ -239,7 +239,7 @@ limitSize vs s = case readSize dataUnits s of
|
||||||
checkkey sz key = return $ keySize key `vs` Just sz
|
checkkey sz key = return $ keySize key `vs` Just sz
|
||||||
check _ sz (Just key) = checkkey sz key
|
check _ sz (Just key) = checkkey sz key
|
||||||
check fi sz Nothing = do
|
check fi sz Nothing = do
|
||||||
filesize <- liftIO $ catchMaybeIO $ getFileSize (relFile fi)
|
filesize <- liftIO $ catchMaybeIO $ getFileSize (currFile fi)
|
||||||
return $ filesize `vs` Just sz
|
return $ filesize `vs` Just sz
|
||||||
|
|
||||||
addMetaData :: String -> Annex ()
|
addMetaData :: String -> Annex ()
|
||||||
|
@ -271,7 +271,7 @@ addTimeLimit s = do
|
||||||
else return True
|
else return True
|
||||||
|
|
||||||
lookupFileKey :: FileInfo -> Annex (Maybe Key)
|
lookupFileKey :: FileInfo -> Annex (Maybe Key)
|
||||||
lookupFileKey = Backend.lookupFile . relFile
|
lookupFileKey = Backend.lookupFile . currFile
|
||||||
|
|
||||||
checkKey :: (Key -> Annex Bool) -> MatchInfo -> Annex Bool
|
checkKey :: (Key -> Annex Bool) -> MatchInfo -> Annex Bool
|
||||||
checkKey a (MatchingFile fi) = lookupFileKey fi >>= maybe (return False) a
|
checkKey a (MatchingFile fi) = lookupFileKey fi >>= maybe (return False) a
|
||||||
|
|
|
@ -19,8 +19,10 @@ data MatchInfo
|
||||||
| MatchingKey Key
|
| MatchingKey Key
|
||||||
|
|
||||||
data FileInfo = FileInfo
|
data FileInfo = FileInfo
|
||||||
{ relFile :: FilePath -- may be relative to cwd
|
{ currFile :: FilePath
|
||||||
, matchFile :: FilePath -- filepath to match on; may be relative to top
|
-- ^ current path to the file, for operations that examine it
|
||||||
|
, matchFile :: FilePath
|
||||||
|
-- ^ filepath to match on; may be relative to top of repo or cwd
|
||||||
}
|
}
|
||||||
|
|
||||||
type FileMatcherMap a = M.Map UUID (Utility.Matcher.Matcher (S.Set UUID -> MatchInfo -> a Bool))
|
type FileMatcherMap a = M.Map UUID (Utility.Matcher.Matcher (S.Set UUID -> MatchInfo -> a Bool))
|
||||||
|
|
Loading…
Reference in a new issue