git-annex unused --from remote skips its git-remote-annex keys

This turns out to only be necessary is edge cases. Most of the
time, git-annex unused --from remote doesn't see git-remote-annex keys
at all, because it does not record a location log for them.

On the other hand, git-annex unused does find them, since it does not
rely on the location log. And that's good because they're a local cache
that the user should be able to drop.

If, however, the user ran git-annex unused and then git-annex move
--unused --to remote, the keys would have a location log for that
remote. Then git-annex unused --from remote would see them, and would
consider them unused. Even when they are present on the special remote
they belong to. And that risks losing data if they drop the keys from
the special remote, but didn't expect it would delete git branches they
had pushed to it.

So, make git-annex unused --from skip git-remote-annex keys whose uuid
is the same as the remote.
This commit is contained in:
Joey Hess 2024-05-14 15:12:07 -04:00
parent 0bf72ef103
commit 24af51e66d
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 37 additions and 9 deletions

View file

@ -10,11 +10,6 @@ will be available to users who don't use datalad.
This is implememented and working. Remaining todo list for it:
* git-annex unused --from remote should not treat git manifest and bundle
keys as unused, since that could lead to data loss. It's fine for
git-annex unused on the local repo to treat those as unused since they're
only a local cache.
* Test pushes that delete branches.
* Test incremental pushes that don't fast-forward.