export: Avoid unncessarily re-exporting non-annexed files that were already exported

Commit b6e4ed9aa7 made non-annexed files
be re-uploaded every time, since they're not tracked in the location log,
and it made it check the location log. Don't do that for non-annexed files.

Sponsored-by: Brock Spratlen on Patreon
This commit is contained in:
Joey Hess 2021-11-29 14:02:38 -04:00
parent 05d79b26d8
commit 567f63ba47
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 31 additions and 5 deletions

View file

@ -275,11 +275,20 @@ startExport r db cvar allfilledvar ti = do
af = AssociatedFile (Just f)
ai = ActionItemTreeFile f
si = SeekInput []
notrecordedpresent ek = (||)
<$> liftIO (notElem loc <$> getExportedLocation db ek)
-- If content was removed from the remote, the export db
-- will still list it, so also check location tracking.
<*> (notElem (uuid r) <$> loggedLocations ek)
notrecordedpresent ek =
ifM (liftIO $ notElem loc <$> getExportedLocation db ek)
( return True
-- When content was lost from the remote and
-- a fsck noticed that, the export db will still
-- list it as present in the remote. So also check
-- location tracking.
-- However, git sha keys do not have their locations
-- tracked, and fsck doesn't check them, so not
-- for those.
, if isGitShaKey ek
then return False
else notElem (uuid r) <$> loggedLocations ek
)
performExport :: Remote -> ExportHandle -> Key -> AssociatedFile -> Sha -> ExportLocation -> MVar AllFilled -> CommandPerform
performExport r db ek af contentsha loc allfilledvar = do