On Wed, Mar 06, 2024 at 08:31:15AM +0100, Patrick Steinhardt wrote: > Yeah, the proposed patch basically aims to do the above chained command > in an easier way. I think that this would be a nice addition to make > this easier to use and better discoverable. But in the long run what I > think would be really useful is to extend git-for-each-ref(1) and/or > git-show-ref(1) so that they can print all existing refs with their > direct values. Right now, it's impossible to get a globally consistent > view of all refs in the refdb with their unresolved values. Yeah, it seems like if this were a format-specifier for for-each-ref it would be a lot more flexible. You can do: git for-each-ref --format='%(refname) %(objectname) %(symref)' to get the resolved values next to the symrefs (if any). I think that does a full resolution, though (so again, if you had one->two->three, you can never learn about the intermediate "two"). > That will end up a bit more involved though. The ref iterators we have > right now do not provide any way to return symref targets to the caller, > so we would have to first extend the interfaces and adapt both backends > to support this. But this is kind of where I want to end up. I think for-each-ref in the above command works by calling resolve_refdup() itself, and then recording the result. It would be nice to get it from the iterator, though (more efficient, and avoids any races). -Peff