Not sure if this is a feature request... is it possible to get git-annex whereused --key to act on one or more other branches than the checked-out one... obviously without having to check each individual one out?
Not sure if this is a feature request... is it possible to get git-annex whereused --key to act on one or more other branches than the checked-out one... obviously without having to check each individual one out?
The
--historical
flag ofwhereused
leads to a wider search, including of other branches but also other things, like the current branch's history and the reflog.I'm guessing you're after more specific control.
If I want to know when a key occurred in a particular branch, I usually do something like
To know whether a particular key is in the tip of a particular branch (or of some subset of branches), one way would be
Perhaps there are more streamlined ways to get to that information, though.
Thank you. For your kindness, I think I owe a better explanation.
It might be being a little ambitious... but I am trying to work on a git-annex where I am indexing retired internal drives. Performing a git-annex import --no-content on each setup importtree=yes remote, and then merging/fast-forwarding to a git checkout --orphan'ed branch.
Key point is, now, for example, I want to find out where a file might have been duplicated.
I have considered your idea of the --historical switch. But perhaps related to https://git-annex.branchable.com/bugs/whereused_--key_forcing_--historical._exportree__63__/, I have experienced strange behaviour, now and in the past.
The following sequence might explain.
Now with historical:
To demonstrate that this isn't a exhaustive search, here I am following your suggestion on using git rev-list
Thank you again, because I do have something to work with now in any case.
The --historical option does look for the key in all branches, if the checked out branch does not contain the key.
If that doesn't do what you want, it would be possible to add an option that only looks at branches that match a refspec you provide.
Thank you for the offer. I'm a little sheepish about it though.
Because I'm mindful that my, perhaps over ambition, has knock on effects. eg. is what I am doing (with unrelated branches) breaking how unusued detects unused objects?
If that is the case, I'd understand being consistent and not facilitating this hubris.
It's fine to have multiple unrelated branches in a repository, I don't think you're doing anything wrong.
Currently --historical stops once it finds one use of the key. I think you are wanting to find all uses by any of your branches?
Maybe the right option for this use case would be a --branches that searches each branch for uses of the key and doesn't stop at the first hit. Perhaps combined with a --refspec= option that takes a wildcard that can be used to select which branches to search.