phlgitu_ref: add guess_fq_name() for convenience

Make it easier to deal with git refs by supplying a function that takes
any ref and tries to guess the fully-qualified name.  From the
fully-qualified name it's easy to derive the form that's most
convenient at the point of use.

Test Plan:
Add doctests
$ ./precommit.sh