git_repository_set_head: use tag name in reflog#4174
Conversation
When `git_repository_set_head` is provided a tag reference, update the reflog with the tag name, like we do with a branch. This helps consumers match the semantics of `git checkout tag`.
|
If we're going full-on with this, should we short-hand everything? |
|
Hrmf. I dunno... We could actually be very dwimmy here, but I'm not sure how far we want to go. This is a very middle of the road approach in this PR, but we could actually try to parse what we're given. 🤷♂️ |
|
If you want to include the exact text from the user, that's what |
When `git_repository_set_head` is provided a remote reference, update the reflog with the tag name, like we do with a branch. This helps consumers match the semantics of `git checkout remote`.
|
Right - that makes sense. The acceptance of a ref name string (instead of a ref) was confusing me. In any case, I updated this to deal with shortnames for remote branches. |
Tag names are now recorded in the reflog without a leading `refs/tags/`, beginning in libgit2/libgit2#4174
When
git_repository_set_headis provided a tag reference, update the reflog with the tag name, like we do with a branch. This helps consumers match the semantics ofgit checkout tag.If you think of
git_repository_set_headas an analog togit symbolic-ref HEAD ...then this doesn't make a lot of sense. But I would argue that it's not a perfect analog already togit symbolic-ref, and this is natural for users who want togit checkout ...to switch branches.See #3909