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

clone single branch with depth of 1 #836

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

slimm609
Copy link

cloning only the default branch and with a depth of 1 speeds up the clone time greatly

I0818 19:01:24.786890   27900 git.go:79] Going to run git clone --depth=1 --single-branch -v [email protected]:test/test.git /Users/dbrian/.krew/index/test
Cloning into '/Users/dbrian/.krew/index/test'...
I0818 19:01:25.342370   27900 fetch_tag.go:47] Parsing response from GitHub
I0818 19:00:39.064036   27722 git.go:79] Going to run git clone -v [email protected]:test/test.git /Users/dbrian/.krew/index/test
Cloning into '/Users/dbrian/.krew/index/test'...
I0818 19:00:48.527775   27722 root.go:180] Upgrade check was skipped or has not finished

Fixes #403

cloning only the default branch and with a depth of 1 speeds up the clone time greatly

```sh
I0818 19:01:24.786890   27900 git.go:79] Going to run git clone --depth=1 --single-branch -v [email protected]:test/test.git /Users/dbrian/.krew/index/test
Cloning into '/Users/dbrian/.krew/index/test'...
I0818 19:01:25.342370   27900 fetch_tag.go:47] Parsing response from GitHub
```

```sh
I0818 19:00:39.064036   27722 git.go:79] Going to run git clone -v [email protected]:test/test.git /Users/dbrian/.krew/index/test
Cloning into '/Users/dbrian/.krew/index/test'...
I0818 19:00:48.527775   27722 root.go:180] Upgrade check was skipped or has not finished
```

Signed-off-by: Brian Davis <[email protected]>
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 18, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: slimm609
Once this PR has been reviewed and has the lgtm label, please assign chriskim06 for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot
Copy link
Contributor

Welcome @slimm609!

It looks like this is your first PR to kubernetes-sigs/krew 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/krew has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Aug 18, 2023
@slimm609
Copy link
Author

/assign @ahmetb

@slimm609
Copy link
Author

/assign @Jaanki

@k8s-ci-robot
Copy link
Contributor

@slimm609: GitHub didn't allow me to assign the following users: Jaanki.

Note that only kubernetes-sigs members with read permissions, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time.
For more information please see the contributor guide

In response to this:

/assign @Jaanki

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@ahmetb
Copy link
Member

ahmetb commented Jan 20, 2024

I will try to take a look at this sometime but any mistake here can brick Krew installations forever, and our commit history is not particularly bloated so it's not top priority right now. Let me know if there's a particular reason you're pushing for it.

@slimm609
Copy link
Author

slimm609 commented Jan 20, 2024

thanks @ahmetb. With larger private repos for plugins, it can take a very long time to install or update because it downloads the entire history of the repo just to install and all branch references just to install from the main branch. This changes to only download the most recent commit (no history) and only the repo's main branch instead of the main branch plus all additional branches.

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle stale
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 20, 2024
@slimm609
Copy link
Author

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 22, 2024
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle stale
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 21, 2024
@slimm609
Copy link
Author

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 21, 2024
@ahmetb
Copy link
Member

ahmetb commented Jul 23, 2024

Sorry for the delay here. I have a follow up question: doesn't the subsequent "git fetch origin && git reset -hard @{upstream}" command re-download the repository anyway?

If that's the case, I don't think this optimization is worth doing (and may end up being worse) for long-term installations that install/update plugins on the same machine over time.

@slimm609
Copy link
Author

slimm609 commented Aug 8, 2024

Sorry for the delay here. I have a follow up question: doesn't the subsequent "git fetch origin && git reset -hard @{upstream}" command re-download the repository anyway?

If that's the case, I don't think this optimization is worth doing (and may end up being worse) for long-term installations that install/update plugins on the same machine over time.

git reset --hard @{upstream} will just reset but git fetch -v can be updated to git fetch -v origin HEAD to only apply to the that branch

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle stale
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fetch only master of index, and in shallow mode
4 participants