On Mon, Mar 04, 2024 at 10:51:58PM +0000, John Cai via GitGitGadget wrote: > From: John Cai <johncai86@xxxxxxxxx> > > For reftable development, it would be handy to have a tool to provide > the direct value of any ref whether it be a symbolic ref or not. > Currently there is git-symbolic-ref, which only works for symbolic refs, > and git-rev-parse, which will resolve the ref. Let's add a --unresolved > option that will only take one ref and return whatever it points to > without dereferencing it. What about "git rev-parse --symbolic-full-name"? I don't think that behaves quite the same as your patch here: - it is actually not a true no-deref; it resolves to the final name and then prints it (so the behavior is the same for a single-level symref, but I believe a multi-level symref chain like one->two->three will print "three" when resolving "one"). - it always prints the resolved name, whereas your patch prints an oid for non-symrefs I'm not sure if those are important or not, as I don't quite understand what you're trying to accomplish. I'd probably have just run: git symbolic-ref -q $name || git rev-parse --verify $name I'm not opposed to making that more ergonomic, but I think we should avoid redundant plumbing options if we can (I'm not sure yet if this is redundant or not, but in general I find "show-ref" to be a weird mix of "rev-parse" and "for-each-ref" that I'd be just as happy if it did not exist). -Peff