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

@ -4,6 +4,8 @@ git-annex (8.20211124) UNRELEASED; urgency=medium
* addurl, youtube-dl: When --check-raw prevents downloading an url, * addurl, youtube-dl: When --check-raw prevents downloading an url,
still continue with any downloads that come after it, rather than still continue with any downloads that come after it, rather than
erroring out. erroring out.
* export: Avoid unncessarily re-exporting non-annexed files that were
already exported.
-- Joey Hess <id@joeyh.name> Tue, 23 Nov 2021 15:58:27 -0400 -- Joey Hess <id@joeyh.name> Tue, 23 Nov 2021 15:58:27 -0400

View file

@ -275,11 +275,20 @@ startExport r db cvar allfilledvar ti = do
af = AssociatedFile (Just f) af = AssociatedFile (Just f)
ai = ActionItemTreeFile f ai = ActionItemTreeFile f
si = SeekInput [] si = SeekInput []
notrecordedpresent ek = (||) notrecordedpresent ek =
<$> liftIO (notElem loc <$> getExportedLocation db ek) ifM (liftIO $ notElem loc <$> getExportedLocation db ek)
-- If content was removed from the remote, the export db ( return True
-- will still list it, so also check location tracking. -- When content was lost from the remote and
<*> (notElem (uuid r) <$> loggedLocations ek) -- 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 :: Remote -> ExportHandle -> Key -> AssociatedFile -> Sha -> ExportLocation -> MVar AllFilled -> CommandPerform
performExport r db ek af contentsha loc allfilledvar = do performExport r db ek af contentsha loc allfilledvar = do

View file

@ -27,3 +27,4 @@ git annex from Debian :
### Have you had any luck using git-annex before? (Sometimes we get tired of reading bug reports all day and a lil' positive end note does wonders) ### Have you had any luck using git-annex before? (Sometimes we get tired of reading bug reports all day and a lil' positive end note does wonders)
Its only a bug on what git-annex display. It does the asked work: the file are correctly exported where I look for them. Its only a bug on what git-annex display. It does the asked work: the file are correctly exported where I look for them.
> [[fixed|done]] --[[Joey]]

View file

@ -0,0 +1,14 @@
[[!comment format=mdwn
username="joey"
subject="""comment 1"""
date="2021-11-29T17:32:33Z"
content="""
I think that the most likely reason for this to happen is if the
particular file is not checked into git-annex, but into git.
Since files stored in git are small, re-uploading them is not likely to be
very expensive.
However, I found a way to prevent it doing so. So this is fixed assuming
I guessed right about the cause of it for you.
"""]]