Preferred content path matching bugfix.

When in a subdir, both the normal filepath, and the filepath relative to
the top of the git repo are needed for matching. The former for key lookup,
and the latter for include/exclude to match against. Previously, key lookup
didn't work in this situation.
This commit is contained in:
Joey Hess 2012-10-17 16:01:09 -04:00
parent 59170c4187
commit e7780a39f5
6 changed files with 37 additions and 29 deletions

View file

@ -10,6 +10,7 @@
module Annex (
Annex,
AnnexState(..),
FileInfo(..),
PreferredContentMap,
new,
newState,
@ -77,7 +78,12 @@ instance MonadBaseControl IO Annex where
type Matcher a = Either [Utility.Matcher.Token a] (Utility.Matcher.Matcher a)
type PreferredContentMap = M.Map UUID (Utility.Matcher.Matcher (S.Set UUID -> FilePath -> Annex Bool))
data FileInfo = FileInfo
{ relFile :: FilePath -- may be relative to cwd
, matchFile :: FilePath -- filepath to match on; may be relative to top
}
type PreferredContentMap = M.Map UUID (Utility.Matcher.Matcher (S.Set UUID -> FileInfo -> Annex Bool))
-- internal state storage
data AnnexState = AnnexState
@ -94,7 +100,7 @@ data AnnexState = AnnexState
, checkattrhandle :: Maybe CheckAttrHandle
, forcebackend :: Maybe String
, forcenumcopies :: Maybe Int
, limit :: Matcher (FilePath -> Annex Bool)
, limit :: Matcher (FileInfo -> Annex Bool)
, preferredcontentmap :: Maybe PreferredContentMap
, shared :: Maybe SharedRepository
, forcetrust :: TrustMap