| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
unless you can make this happen in a single fetch I can't accept this. I've tried but have been unable to get the right refspec as written this invokes 3 remote operations which from some local testing is often slower than the full clone which defeats the entire purpose of shallow fetching in the first place |
Sorry, something went wrong.
|
@asottile Thank you for your feedback. I understand that there is no simple way to fetch a single remote tag efficiently. For repositories that require version metadata, and where most rev values correspond to tags, I have added a small workaround that creates a local tag pointing to FETCH_HEAD. Although the rev may occasionally be a commit hash rather than a tag, this approach ensures that we can support these repositories in most cases. 😄 |
Sorry, something went wrong.
| git_config = 'protocol.version=2' | ||
| git_cmd('-c', git_config, 'fetch', 'origin', ref, '--depth=1') | ||
| git_cmd('checkout', 'FETCH_HEAD') | ||
| git_cmd('tag', '-a', '-m', '""', ref, 'FETCH_HEAD') |
There was a problem hiding this comment.
I don't think this is good either. this will tag non-tags (and invoke signing mechanisms)
Sorry, something went wrong.
There was a problem hiding this comment.
Yes, this will tag non-tag revisions but limit to local. As long as pre-commit does not push changes, this will not affect the remote or introduce signing issues.
Sorry, something went wrong.
There was a problem hiding this comment.
-m invokes signing. and if this tags things differently than the actual repo that's not ok
Sorry, something went wrong.
There was a problem hiding this comment.
My understanding is that -m does not trigger signing unless -s is used.
git does not provide a direct way to fetch a specific tag at a particular commit. The only single-command option is to use --tags with git fetch, but that would retrieve all tags and be slower than creating a fake local tag.
What do you think about the 3rd proposal on git_cmd('-c', git_config, 'fetch', 'origin', ref, '--depth=1', '--tags') ?
Sorry, something went wrong.
There was a problem hiding this comment.
your understanding is slightly wrong. and no --tags will not work that will fetch a bunch of unnecessary stuff
Sorry, something went wrong.
|
Try an alternative approach by using git fetch origin refs/tags on a best-effort basis. If rev contains a tag, it will be fetched as well. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
pre-commit shallow clones do not fetch tags, which leads to errors when a repository depends on tag metadata (see golangci/golangci-lint#6347).
This PR adds logic to resolve and fetch the remote tag associated with FETCH_HEAD when present.