-
Notifications
You must be signed in to change notification settings - Fork 743
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support fetching/checkouts of non-branch/-tag git refs #322
Support fetching/checkouts of non-branch/-tag git refs #322
Conversation
Provides a `source.git.ref` field for specifying a specific non-branch non-tag git ref at which to perform a checkout. Providing one will result in a shallow (depth 1) clone of the repo and shallow subsequent fetches. The motivation for this change is to support sourcing of trigger templates from Gerrit patchsets. Gerrit uses non-branch/-tag refs extensively and specifically in this case stores change patchsets in `refs/changes/[slice]/[change]/[patchset]`. While arbitrary refs are kind of an obscure git feature, there very well may be other git based systems utilizing them.
While I was implementing this change, I was a little confused about these var (
fetchRefSpec = []config.RefSpec{
"refs/*:refs/*",
"HEAD:refs/heads/HEAD",
}
) Why such an aggressive fetch of The second one seems to confuse git by creating an actual branch named Anyway, since I don't know the history behind those refspecs, I didn't want to touch it, and simply included a conditional exemption for when |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left a comment, everything else looks good.
Thanks for the merge! |
* Support fetching/checkouts of non-branch/-tag git refs Provides a `source.git.ref` field for specifying a specific non-branch non-tag git ref at which to perform a checkout. Providing one will result in a shallow (depth 1) clone of the repo and shallow subsequent fetches. The motivation for this change is to support sourcing of trigger templates from Gerrit patchsets. Gerrit uses non-branch/-tag refs extensively and specifically in this case stores change patchsets in `refs/changes/[slice]/[change]/[patchset]`. While arbitrary refs are kind of an obscure git feature, there very well may be other git based systems utilizing them. * Fixed protobuf field index for Ref
Provides a
source.git.ref
field for specifying a specific non-branchnon-tag git ref at which to perform a checkout. Providing one will
result in a shallow (depth 1) clone of the repo and shallow subsequent
fetches.
The motivation for this change is to support sourcing of trigger
templates from Gerrit patchsets. Gerrit uses non-branch/-tag refs
extensively and specifically in this case stores change patchsets in
refs/changes/[slice]/[change]/[patchset]
. While arbitrary refs arekind of an obscure git feature, there very well may be other git based
systems utilizing them.