git-annex find --not --unused is currently the same as git-annex find
--unused because --unused is not a file matching option. This is a bit
confusing.
And it would be useful to have a way to find all keys that are not amoung the unused keys.
Given the implementation of --not is tied to file matching options,
it might be best to add a new option like --used or --not-unused.
It would also perhaps be good to detect when matching options are used that
don't make sense, and error out on commands like git-annex find --not
or git-annex find -and -(
It would also perhaps be good to detect when matching options are used that don't make sense, and error out on commands like git-annex find --not or git-annex find -and -(might actually be more important than the first!git-annex finddoes not accept the--unusedoption. Only copy, drop, get, whereis, and a few other commands like that do.But, the bug still holds, for example
git-annex get --not --unusedwill confusingly get all unused files and not any other files.There is a similar problem with
--not --key=foo, which might be expected to get all other keys. Or even--not --branch=foo.It seems difficult to detect all such mistakes though. Consider
git-annex get --not --unused --smallerthan=1mb. The user might expect that to get small files that are not unused, but actually it gets large files that are unused. To detect that mistake, the option parser for--unused(and--keyand--branch) would need to detect that a file matching expression was started before it, and is not complete.I think at some point it just doesn't make sense to prevent user foot shooting.
--notis well documented in what it can be used with, and if the user comes up with some combination of options that includes it and tries to read it as english, we'd even have to worry about things like rejecting--not --quiet --smallerthan=1mbsince the user might expect it to behave like--verbose.A
--usedtype file matching option would only make sense combined with--allor perhaps--key. Otherwise, it's the default to not operate on unused keys, because commands operate on keys that are referenced by files in the working tree.Having that as a file matching option would open a new user confusion. Consider "git-annex drop --not --used". That would never drop any files because
dropby default operates only on used files.(Except for in the case where
git-annex unusedwas run in the past, then an unused file were added back to the tree.. then it would surprise the user in a different way!)Given that
--unusedis already potentially confusing since it's not a file matching option and can behave in surprising ways when treated as one, having a--usedor similar that is a file matching option but doesn't usually do anything seems like it only adds to the confusion.