buf icon indicating copy to clipboard operation
buf copied to clipboard

Fix git ref to allow branches and tags

Open emcfarlane opened this issue 1 year ago • 0 comments

This changes the git ref input to align with the git notion of a ref as a tag or branch. We now always try to fetch a given ref before falling back to fetching the HEAD to resolve partial refs. If both a ref and branch are provided, the branch is fetched directly before resolving the ref. The inputs tag and commit can still be used but can now be replaced by setting the ref.

For example:

  • Branch ref=main will fetch and checkout the main branch
  • Tag ref=v1.0.0 will fetch and checkout the v1.0.0 tag
  • Partial ref=123456 will fetch HEAD and checkout 123456
  • Branch with partial ref=123456,branch=feature will fetch feature and checkout 123456
  • Commit ref=<sha> will fetch <sha> and checkout <sha>
  • Branch with commit ref=<sha>,branch=feature with fetch feature and checkout <sha>

Fixes #2932

emcfarlane avatar Jun 18 '24 15:06 emcfarlane