annex.addunlocked support for tree imports

Honor annex.addunlocked configuration when importing a tree from a special
remote.

Note, in a --no-content import, the object file will not be populated
(usually) and so expressions that match on mime type will not match. Tested
this and it works ok, the file just ends up locked. Updated docs for the
mime expressions to mention that they can't match when the file is present

Note that in Command.Sync.pullThirdPartyPopulated, recordImportTree is
called without a AddUnlockedMatcher. Since the tree generated here is not
exposed to the user and does not contain usual filenames, there is no need
of the overhead of checking it.
This commit is contained in:
Joey Hess 2024-12-19 11:43:22 -04:00
parent 02169a1ce3
commit 29b3c7c660
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
9 changed files with 93 additions and 30 deletions

View file

@ -53,6 +53,7 @@ import Annex.Path
import Annex.Wanted
import Annex.Content
import Annex.WorkTree
import Annex.FileMatcher
import Command.Get (getKey')
import qualified Command.Move
import qualified Command.Export
@ -77,7 +78,6 @@ import Annex.CurrentBranch
import Annex.Import
import Annex.CheckIgnore
import Annex.PidLock
import Types.FileMatcher
import Types.GitConfig
import Types.Availability
import qualified Database.Export as Export
@ -580,7 +580,8 @@ importRemote importcontent o remote currbranch
let (branch, subdir) = splitRemoteAnnexTrackingBranchSubdir b
if canImportKeys remote importcontent
then do
Command.Import.seekRemote remote branch subdir importcontent (CheckGitIgnore True) []
addunlockedmatcher <- addUnlockedMatcher
Command.Import.seekRemote remote branch subdir importcontent (CheckGitIgnore True) addunlockedmatcher []
-- Importing generates a branch
-- that is not initially connected
-- to the current branch, so allow
@ -607,7 +608,7 @@ pullThirdPartyPopulated o remote
where
go (Just importable) = importChanges remote ImportTree False True importable >>= \case
ImportFinished imported -> do
(_t, updatestate) <- recordImportTree remote ImportTree imported
(_t, updatestate) <- recordImportTree remote ImportTree Nothing imported
next $ do
updatestate
return True