forked from bruce/puppet-vcsrepo
-
Notifications
You must be signed in to change notification settings - Fork 286
Open
Labels
Description
Use Case
There is also an optimisation if the cloned repo is at the correct revision: https://github.com/puppetlabs/puppetlabs-vcsrepo/blob/main/lib/puppet/provider/vcsrepo/git.rb#L529-L532 introduced in #380
But this only works with full SHAs.
When the SHA isn't an exact match, a git fetch is run, which can potentially be slow for large repos
Describe the Solution You Would Like
git rev-parse HEAD is used to get the current commit for use in comparison, which returns the full sha.
Could that command change to git rev-parse --short={@resource.value(:revision).length} HEAD for the comparison?
This would then match, and not bother with the rest of the get_revision function.