Working on the Baobáxia project, we have this interesting problem: If some content is added twice with different file names, it will appear in the git-annex repository as two symlinks pointing to the same file in the annex.
So far so good.
But this means that if I want to delete a file, I have two cases:
- If this content was added only once, I need to drop the binary content with git annex drop and afterwards remove the symlink with git rm.
- If this content exists under more than one file name, I need to remove the symlink with git rm only; I should not drop the content.
So the question is: How do I know that, apart from searching through the whole repository? Is there a more efficient way? After going through the manual I can't find it, but I may have overlooked something.
Best regards and TIA for any response Carsten Agger
Note: This question references bug #191 in the Baobáxia project, https://github.com/RedeMocambos/baobaxia/issues/191
You don't need to keep track of links. Just delete the links, then run:
This will find any content that isn't linked to. You can then run git-annex dropunused to free up space.
See these man pages:
https://git-annex.branchable.com/git-annex-unused/
https://git-annex.branchable.com/git-annex-dropunused/
This deduplication is generally considered a feature. (If you don't want it, you can eg use the WORM backend.)
The
git annex unused
command can be used in this case. It looks through all files (in all branches) in the repo and finds content that no files are using, which can then be dropped.So the question is, if you've been using
git annex drop
before deleting a file, how do you know when you need to not do that, and instead usegit annex unused
after deleting a file? Well, my suggestion is to just never get in the habit ofgit annex drop
before deleting a file. Reserve usinggit annex drop
for times when you are getting low on disk space and need to free some up by dropping content from local storage; don't try to manually manage which content is stored in the local repository as long as you have enough free disk space.