tg.sh: use --no-deref when returning to a detached HEAD
commit8cd7fd0b927a03dd36348eca40e26482e69aeed3
authorKyle J. McKay <mackyle@gmail.com>
Mon, 27 Mar 2017 05:56:33 +0000 (26 22:56 -0700)
committerKyle J. McKay <mackyle@gmail.com>
Mon, 27 Mar 2017 05:56:33 +0000 (26 22:56 -0700)
tree557986df6b431a53a4d85ac79950c82b08b6e80c
parent8c41b6b534d84deec0aac5868e1b2b3e98c118d2
tg.sh: use --no-deref when returning to a detached HEAD

When tg update gained the ability to return to arbitrary HEADs,
including detached ones, checkout_symref_full gained that same
ability to support the operation.

Unfortunately it failed to add --no-deref when setting the
HEAD ref and if that HEAD happened to be a symbolic ref then
the destination ref would end up getting stepped on instead
of making HEAD detached at the target revision.

The bug would only trigger if a fresh tg update (i.e. not a
--continue) was run when HEAD was already detached and the
update operation left HEAD attached at the time it was ready
to return to the original value.

Fix this by adding the necessary --no-deref when checking out
a detached HEAD (i.e. a hash instead of a ref name).

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