deal with ignoreinode config setting
Improve handling of directory special remotes with importtree=yes whose
ignoreinode setting has been changed. (By either enableremote or by
upgrading to commit 3e2f1f73cb
.)
When getting a file from such a remote, accept the content that would have
been accepted with the previous ignoreinode setting.
After a change to ignoreinode, importing a tree from the remote will
re-import and generate new content identifiers using the new config. So
when ignoreinode has changed to no, the inodes will be learned, and after
that point, a change in an inode will be detected as a change. Before
re-importing, a change in an inode will be ignored, as it was before the
ignoreinode change. This seems acceptble, because the user can re-import
immediately if they urgently need to add inodes. And if not, they'll
do it sometime, presumably, and the change will take effect then.
Sponsored-by: Erik Bjäreholt on Patreon
This commit is contained in:
parent
4a1030d51d
commit
1fe9cf7043
4 changed files with 34 additions and 2 deletions
|
@ -390,10 +390,24 @@ mkContentIdentifier (IgnoreInodes ii) f st =
|
|||
then toInodeCache' noTSDelta f st 0
|
||||
else toInodeCache noTSDelta f st
|
||||
|
||||
-- Since ignoreinodes can be changed by enableremote, and since previous
|
||||
-- versions of git-annex ignored inodes by default, treat two content
|
||||
-- idenfiers as the same if they differ only by one having the inode
|
||||
-- ignored.
|
||||
guardSameContentIdentifiers :: a -> ContentIdentifier -> Maybe ContentIdentifier -> a
|
||||
guardSameContentIdentifiers cont old new
|
||||
| new == Just old = cont
|
||||
guardSameContentIdentifiers _ _ Nothing = giveup "file not found"
|
||||
guardSameContentIdentifiers cont old (Just new)
|
||||
| new == old = cont
|
||||
| ignoreinode new == old = cont
|
||||
| new == ignoreinode old = cont
|
||||
| otherwise = giveup "file content has changed"
|
||||
where
|
||||
ignoreinode cid@(ContentIdentifier b) =
|
||||
case readInodeCache (decodeBS b) of
|
||||
Nothing -> cid
|
||||
Just ic ->
|
||||
let ic' = replaceInode 0 ic
|
||||
in ContentIdentifier (encodeBS (showInodeCache ic'))
|
||||
|
||||
importKeyM :: IgnoreInodes -> RawFilePath -> ExportLocation -> ContentIdentifier -> ByteSize -> MeterUpdate -> Annex (Maybe Key)
|
||||
importKeyM ii dir loc cid sz p = do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue