I have a particular annexed file (call its key K), and I'm trying to find out why git annex considers it in-use.
Joey's comment to Dead repo content is not considered unused does a good job of explaining why, in theory, a file might be considered in-use.
But how can I determine, in a particular case, why a given file is in-use? I.e. how can I determine what's referencing it?
Things I've tried:
git annex unused --used-refspec=+foo, where I'm certain that neither tag foo nor any of its ancestors references the file in question (that command doesn't report any unused files)
Verifying that there are now no symlinks to the annex object in question
git log --stat --no-textconv -S'K' (which produces no output)
Background:
git annex unused listed K as unused. I wanted to see what it was, so I did git annex addunused on it to create a symlink. (As expected, after this, git annex unused reported no unused files.)
Having determined that the file was in fact no longer needed, I rm'ed the symlink, expecting git annex unused to again report K as unused. But it doesn't; it still reports no unused files.
I'm not aware of having done anything that would create a reference other than addunused's new symlink, but clearly I did so without being aware of it...
So I'm trying to figure out where that reference is, so I can stomp on it and then git annex dropunused to get rid of the file for good.
Thanks.
Is it in use in git's index? git-annex addunused adds a link to the working tree, and also stages it in the index. You said "I rm'ed the symlink", but that would leave it in the index, so still used.
(It's also theoretically possible for git-annex unused to incorrectly decide something is unused that is not -- it uses a bloom filter which can have false positives -- but this is highly unlikely unless your repo has a huge number of files in it. The annex.bloomaccuracy and annex.bloomaccuracy configs can be used to tweak the bloom filter.)
That's odd. Did you also remove it from the index (
git rm
)?Perhaps try with
--all
to do a wider search, though given what you said above (that is was reported as unused before usingaddunused
) my bet would be on the index."Is it in use in git's index?"
That was it; after git reset, the file is now again reported as unused.
Thanks, and sorry for the noise.