add key to FileInfo

MatchingKey is not the thing to use when matching on actual worktreee
files.

Fix reversion in 8.20201116 that made include= and exclude= in
preferred/required content expressions match a path relative to the current
directory, rather than the path from the top of the repository.
This commit is contained in:
Joey Hess 2020-12-14 17:42:02 -04:00
parent 205a837e8a
commit 01527b21d8
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
13 changed files with 48 additions and 13 deletions

View file

@ -184,7 +184,7 @@ start o si file addunlockedmatcher = do
perform :: AddOptions -> RawFilePath -> AddUnlockedMatcher -> CommandPerform
perform o file addunlockedmatcher = withOtherTmp $ \tmpdir -> do
lockingfile <- not <$> addUnlocked addunlockedmatcher
(MatchingFile (FileInfo (Just file) file))
(MatchingFile (FileInfo (Just file) file Nothing))
let cfg = LockDownConfig
{ lockingFile = lockingfile
, hardlinkFileTmpDir = Just tmpdir

View file

@ -241,6 +241,7 @@ startLocal o addunlockedmatcher largematcher mode (srcfile, destfile) =
let mi = MatchingFile $ FileInfo
{ contentFile = Just srcfile
, matchFile = destfile
, matchKey = Nothing
}
lockingfile <- not <$> addUnlocked addunlockedmatcher mi
-- Minimal lock down with no hard linking so nothing

View file

@ -569,7 +569,7 @@ getDirStatInfo o dir = do
where
initial = (emptyKeyInfo, emptyKeyInfo, emptyNumCopiesStats, M.empty)
update matcher fast key file vs@(presentdata, referenceddata, numcopiesstats, repodata) =
ifM (matcher $ MatchingFile $ FileInfo (Just file) file)
ifM (matcher $ MatchingFile $ FileInfo (Just file) file (Just key))
( do
!presentdata' <- ifM (inAnnex key)
( return $ addKey key presentdata

View file

@ -135,7 +135,7 @@ send ups fs = do
(fs', cleanup) <- seekHelper id ww LsFiles.inRepo
=<< workTreeItems ww fs
matcher <- Limit.getMatcher
let addlist f o = whenM (matcher $ MatchingFile $ FileInfo (Just f) f) $
let addlist f o = whenM (matcher $ MatchingFile $ FileInfo (Just f) f Nothing) $
liftIO $ hPutStrLn h o
forM_ fs' $ \(_, f) -> do
mk <- lookupKey f