-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
git_repository should --depth=1 fetch of sha1 #8969
Comments
What do you think, Klaus? |
Well, as the introduction to this issue states ...
... this is a policy decision by the administrator of the git server, i.e., the question is not whether the server is able to do so, but if it is willing to (with the default being to not allow it). This is why As far as I know, the policy in this respect hasn't changed for the majority of git servers, so my suggestion would be to make this opt-in (to not add additional round trips by failing attempts to clone with |
I’ve made a PR that attempts to take advantage of the |
I'd quite like this feature. When cloning a high velocity repo from Github, not setting |
The Git server config setting uploadpack.allowReachableSHA1InWant and friends allow git fetch to request a particular commit, which is more efficient than fetching all refs and then checking out the commit locally. Attempt to do this, and fall back to fetching everything if it fails. Resolves bazelbuild#8969 Closes bazelbuild#10137. PiperOrigin-RevId: 333298608
Description of the feature request:
Since some years back, it is possible to do
git fetch origin --depth=1 <sha1>
if the server has enabled the configurationuploadpack.allowReachableSHA1InWant
. When specifying a sha1 in thegit_repository
rule, first try a shallow fetch (--depth=1
, not--shallow-since
) of the specific sha1 before doinggit fetch --all
.Feature requests: what underlying problem are you trying to solve with this feature?
By fetching just the specific commit that is wanted, nothing more, the network traffic can be reduced. It is also a clean interface in specifying exactly what is wanted.
Implemented this way, the
shallow_since
argument will not be needed. It could be implemented to recommend that eithershallow_since=<timestamp>
orshallow_sha1=True
is set, depending on what the server is capable of. This would make it possible to write a fullgit_repository
call with only the sha1 and without finding out the commit date.Have you found anything relevant by searching the web?
I could not find any GitHub issue relating to this.
The text was updated successfully, but these errors were encountered: