summaryrefslogtreecommitdiff
path: root/Logs/PreferredContent.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-10-17 16:01:09 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-10-17 16:01:09 -0400
commit998f57820295857891d123ca1592c9c2e54e94c1 (patch)
treebaf0a9f39457dc6c51d7c0408e126da74397204a /Logs/PreferredContent.hs
parent2c7c9811b3253e293535680762709adacecc0f2a (diff)
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.
Diffstat (limited to 'Logs/PreferredContent.hs')
-rw-r--r--Logs/PreferredContent.hs12
1 files changed, 8 insertions, 4 deletions
diff --git a/Logs/PreferredContent.hs b/Logs/PreferredContent.hs
index 049d6b86b..d3c120b70 100644
--- a/Logs/PreferredContent.hs
+++ b/Logs/PreferredContent.hs
@@ -46,15 +46,19 @@ preferredContentSet NoUUID _ = error "unknown UUID; cannot modify"
{- Checks if a file is preferred content for the specified repository
- (or the current repository if none is specified). -}
-isPreferredContent :: Maybe UUID -> AssumeNotPresent -> TopFilePath -> Annex Bool
+isPreferredContent :: Maybe UUID -> AssumeNotPresent -> FilePath -> Annex Bool
isPreferredContent mu notpresent file = do
+ matchfile <- getTopFilePath <$> inRepo (toTopFilePath file)
+ let fi = Annex.FileInfo
+ { Annex.matchFile = matchfile
+ , Annex.relFile = file
+ }
u <- maybe getUUID return mu
m <- preferredContentMap
case M.lookup u m of
Nothing -> return True
- Just matcher ->
- Utility.Matcher.matchMrun matcher $ \a ->
- a notpresent (getTopFilePath file)
+ Just matcher -> Utility.Matcher.matchMrun matcher $ \a ->
+ a notpresent fi
{- Read the preferredContentLog into a map. The map is cached for speed. -}
preferredContentMap :: Annex Annex.PreferredContentMap