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:
Joey Hess 2022-09-16 14:11:25 -04:00
parent 4a1030d51d
commit 1fe9cf7043
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 34 additions and 2 deletions

View file

@ -32,6 +32,7 @@ module Utility.InodeCache (
inodeCacheToMtime,
inodeCacheToEpochTime,
inodeCacheEpochTimeRange,
replaceInode,
SentinalFile(..),
SentinalStatus(..),
@ -125,6 +126,10 @@ inodeCacheEpochTimeRange i =
let t = inodeCacheToEpochTime i
in (t-1, t+1)
replaceInode :: FileID -> InodeCache -> InodeCache
replaceInode inode (InodeCache (InodeCachePrim _ sz mtime)) =
InodeCache (InodeCachePrim inode sz mtime)
{- For backwards compatability, support low-res mtime with no
- fractional seconds. -}
data MTime = MTimeLowRes EpochTime | MTimeHighRes POSIXTime