tg-revert.sh: try to tame rev-parse --symbolic-full-ref
commitb186925706bf432d39deb27e766730df4df32fa4
authorKyle J. McKay <mackyle@gmail.com>
Wed, 14 Mar 2018 05:28:59 +0000 (13 22:28 -0700)
committerKyle J. McKay <mackyle@gmail.com>
Wed, 14 Mar 2018 05:28:59 +0000 (13 22:28 -0700)
tree2a26affdd223978ad92632e4a237b6da19c03bdb
parent4a7180b466f7edb970c549fb0534b080bd8b0154
tg-revert.sh: try to tame rev-parse --symbolic-full-ref

Before giving up on a `git rev-parse --symbolic-ref-name` result,
explicitly prefix the given ref with "refs/tags/" and try once more
before deciding it's not usable.

If there are multiple matches causing --symbolic-ref-name to fail
(the list from `git help revisions`), we're unlikely to care about
anything not under refs/tags/... (except for refs/tgstash and that
can always be written --stash to disambiguate).

We're going to default to interpreting it as a refs/tags/...
something anyway (and then fail using that if it's invalid) so it
does no harm and it will provide an improved DWIM experience when
there happen to be branches and tags with the same name present.

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
tg-revert.sh