Skip to content
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

Attempt to git fetch only specified commit #10137

Closed
wants to merge 1 commit into from

Conversation

HackAttack
Copy link
Contributor

@HackAttack HackAttack commented Oct 31, 2019

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 #8969

@aiuto
Copy link
Contributor

aiuto commented Oct 31, 2019

Is there a corresponding issue?

@aiuto aiuto requested a review from irengrig October 31, 2019 13:37
@aiuto aiuto added the team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. label Oct 31, 2019
@HackAttack
Copy link
Contributor Author

Looks like there is, I should have looked beforehand. This resolves #8969 (cc @aehlig). I can amend the commit message, or just update the PR description if that’s sufficient.

@HackAttack
Copy link
Contributor Author

Also happy to add tests if someone can provide guidance on where is the appropriate place (git_repository_test.sh? skylark_git_repository_test.sh? GitRepositoryBlackBoxTest.java?).

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.
@aiuto aiuto self-requested a review May 11, 2020 20:04
@aiuto
Copy link
Contributor

aiuto commented May 11, 2020

This seems reasonable and non-breaking, so we won't have to guard it with an incompatible flag. I think it addresses @aehlig's comment about it being opt-in, and no overhead if they server does not support the feature. At least, that was how I read the code.

@HackAttack Do you think you can add a test to any of the places you listed? Maybe the black box test.

@philwo philwo added the team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website label Jun 15, 2020
@meisterT meisterT requested a review from philwo July 14, 2020 21:06
@bazel-io bazel-io closed this in ceeb9b8 Sep 23, 2020
Yannic pushed a commit to Yannic/bazel that referenced this pull request Oct 5, 2020
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
@philwo philwo removed the team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website label Nov 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

git_repository should --depth=1 fetch of sha1
5 participants