I've been organizing my music collection deleted/replaces some files but git-annex unused does not show any unused files even though they are deleted and all repos are in sync.
git log --stat --all -S'SHA256E-s8034842--5c3475d7fef6f0c3545721f34e7cbfb6727a00708bdde192f0f1d53af251b444'
commit a0fecdc02f7564f8bce9726f6b934fefc11de58b
Date: Thu Sep 12 17:04:53 2013 +0300
Deleted
.../Dido - Sitting On the Roof of the World.mp3 | 1 -
1 file changed, 1 deletion(-)
commit 7f216228fc0e6298f0290ee1d8646bc9b16eca10
Date: Mon Aug 5 03:49:55 2013 +0200
Initial Import
.../Dido - Sitting On the Roof of the World.mp3 | 1 +
1 file changed, 1 insertion(+)`
even though the file is deleted its still present in annex objects,
find .git -name '*5c3475d7fef6f0c3545721f34e7cbfb6727a00708bdde192f0f1d53af251b444*' -exec ls -al '{}' \;
total 7856
dr-xr-xr-x 2 user user 4096 Sep 9 01:24 .
drwxrwxr-x 3 user user 4096 Sep 9 01:24 ..
-r--r--r-- 1 user user 8034842 Aug 5 04:52 SHA256E-s8034842--5c3475d7fef6f0c3545721f34e7cbfb6727a00708bdde192f0f1d53af251b444.mp3
-r--r--r-- 1 user user 8034842 Aug 5 04:52 .git/annex/objects/Jz/74/SHA256E-s8034842--5c3475d7fef6f0c3545721f34e7cbfb6727a00708bdde192f0f1d53af251b444.mp3/SHA256E-s8034842--5c3475d7fef6f0c3545721f34e7cbfb6727a00708bdde192f0f1d53af251b444.mp3
I got around 200 files that should be deleted but not showing up in unused. I though maybe one of the dead repos is causing the problem so i did a,
git annex forget --drop-dead
and synced all repos. Still I can not get them to drop.
git branch -a
to see all branches (a tag could also do it).I did not create tags or branches, running returns,
git annex sync
might not be updating certian of these branches, such as remotes/origin/HEAD. You can check the branches out and see which still contains your deleted files.So this is a bare repository?
It seems to have had an origin at one point; see the remotes/origin/ branches. If it no longer has that remote, then of course those branches will not be getting updated, and so will contain the old files and that's why unused won't find them. In that case, you could safely remove the remotes/origin/ branches.
It is a non bare repo, I am using the following setup,
http://git-annex.branchable.com/forum/Annex_dropping_files/
As someone else ran into a similar case of this, let me explain a little bit more..
git-annex unused
finds files that are not used by the currently checked out branch, or any other branch or tag. This includes remote branches.This is an important safeguard, because there might be a clone of the repository that intentionally still has that file checked out, and it wouldn't be good for
git-annex unused
to treat such a file as unused.But if there's an old remote, that's perhaps not getting updated any longer and has a branch that points to a file,
git annex unused
won't find that file as unused.So, one solution is to use
git remote rm
to delete the old remote. Or, otherwise get git to delete the old remote branch that is keeping the file around.The other solution is to run something like
git annex unused --used-refspec=+master
What this does is only considers the local master branch as used, and not any other branch or tags. I'd recommend only using this with caution."joeyh" just helped me on irc, because I had this very same problem. I have git-annex repositories in A, and in external hard disks B, C, D, ...
If I remove a file in A, I mean to 1) free space in A (drop) and 2) this to propagate later to the drives.
No matter what "git annex sync" you do from A, the hard disks in your armchair will keep references to the file in their checkout, so A will refuse to drop the file contents until you run "git annex sync" from each of your external hard disks.
What you need (and what I also needed) was to rule the drop/unused from A alone. You have to use "git annex unused --used-refspec=+master" from A, and that will only keep into account the contents referenced by your current A master, ignoring the checkouts of B, C, D, ...
The "used-refspec" can even be set up in the git config.