buf
buf copied to clipboard
Fix git ref to allow branches and tags
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=mainwill fetch and checkout themainbranch - Tag
ref=v1.0.0will fetch and checkout thev1.0.0tag - Partial
ref=123456will fetchHEADand checkout123456 - Branch with partial
ref=123456,branch=featurewill fetchfeatureand checkout123456 - Commit
ref=<sha>will fetch<sha>and checkout<sha> - Branch with commit
ref=<sha>,branch=featurewith fetchfeatureand checkout<sha>
Fixes #2932